⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.225
Server IP:
97.74.87.16
Server:
Linux 16.87.74.97.host.secureserver.net 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
opt
/
python38
/
lib
/
python3.8
/
ctypes
/
test
/
View File Name :
test_repr.py
from ctypes import * import unittest subclasses = [] for base in [c_byte, c_short, c_int, c_long, c_longlong, c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong, c_float, c_double, c_longdouble, c_bool]: class X(base): pass subclasses.append(X) class X(c_char): pass # This test checks if the __repr__ is correct for subclasses of simple types class ReprTest(unittest.TestCase): def test_numbers(self): for typ in subclasses: base = typ.__bases__[0] self.assertTrue(repr(base(42)).startswith(base.__name__)) self.assertEqual("<X object at", repr(typ(42))[:12]) def test_char(self): self.assertEqual("c_char(b'x')", repr(c_char(b'x'))) self.assertEqual("<X object at", repr(X(b'x'))[:12]) if __name__ == "__main__": unittest.main()