Linux ip-148-66-134-25.ip.secureserver.net 3.10.0-1160.119.1.el7.tuxcare.els10.x86_64 #1 SMP Fri Oct 11 21:40:41 UTC 2024 x86_64
Apache
: 148.66.134.25 | : 3.147.68.201
66 Domain
8.0.30
amvm
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
opt /
python35 /
lib /
python3.5 /
ctypes /
test /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
__init__.py
399
B
-rw-r--r--
__main__.py
68
B
-rw-r--r--
test_anon.py
2
KB
-rw-r--r--
test_array_in_pointer.py
1.7
KB
-rw-r--r--
test_arrays.py
5.64
KB
-rw-r--r--
test_as_parameter.py
6.61
KB
-rw-r--r--
test_bitfields.py
9.84
KB
-rw-r--r--
test_buffers.py
2.23
KB
-rw-r--r--
test_bytes.py
1.88
KB
-rw-r--r--
test_byteswap.py
11.14
KB
-rw-r--r--
test_callbacks.py
9.31
KB
-rw-r--r--
test_cast.py
3.11
KB
-rw-r--r--
test_cfuncs.py
7.5
KB
-rw-r--r--
test_checkretval.py
968
B
-rw-r--r--
test_delattr.py
533
B
-rw-r--r--
test_errno.py
2.25
KB
-rw-r--r--
test_find.py
2.1
KB
-rw-r--r--
test_frombuffer.py
4.59
KB
-rw-r--r--
test_funcptr.py
3.82
KB
-rw-r--r--
test_functions.py
12.26
KB
-rw-r--r--
test_incomplete.py
1023
B
-rw-r--r--
test_init.py
1.01
KB
-rw-r--r--
test_internals.py
2.57
KB
-rw-r--r--
test_keeprefs.py
3.96
KB
-rw-r--r--
test_libc.py
1005
B
-rw-r--r--
test_loading.py
4.52
KB
-rw-r--r--
test_macholib.py
1.79
KB
-rw-r--r--
test_memfunctions.py
3.22
KB
-rw-r--r--
test_numbers.py
9.07
KB
-rw-r--r--
test_objects.py
1.64
KB
-rw-r--r--
test_parameters.py
6.05
KB
-rw-r--r--
test_pep3118.py
7.65
KB
-rw-r--r--
test_pickling.py
2.17
KB
-rw-r--r--
test_pointers.py
6.95
KB
-rw-r--r--
test_prototypes.py
6.68
KB
-rw-r--r--
test_python_api.py
2.8
KB
-rw-r--r--
test_random_things.py
2.76
KB
-rw-r--r--
test_refcounts.py
2.52
KB
-rw-r--r--
test_repr.py
842
B
-rw-r--r--
test_returnfuncptrs.py
2.83
KB
-rw-r--r--
test_simplesubclasses.py
1.26
KB
-rw-r--r--
test_sizes.py
815
B
-rw-r--r--
test_slicing.py
5.88
KB
-rw-r--r--
test_stringptr.py
2.48
KB
-rw-r--r--
test_strings.py
6.97
KB
-rw-r--r--
test_struct_fields.py
1.47
KB
-rw-r--r--
test_structures.py
16.24
KB
-rw-r--r--
test_unaligned_structures.py
1.19
KB
-rw-r--r--
test_unicode.py
1.72
KB
-rw-r--r--
test_values.py
3.75
KB
-rw-r--r--
test_varsize_struct.py
1.8
KB
-rw-r--r--
test_win32.py
5.16
KB
-rw-r--r--
test_wintypes.py
1.43
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : test_arrays.py
import unittest from ctypes import * from ctypes.test import need_symbol formats = "bBhHiIlLqQfd" formats = c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint, \ c_long, c_ulonglong, c_float, c_double, c_longdouble class ArrayTestCase(unittest.TestCase): def test_simple(self): # create classes holding simple numeric types, and check # various properties. init = list(range(15, 25)) for fmt in formats: alen = len(init) int_array = ARRAY(fmt, alen) ia = int_array(*init) # length of instance ok? self.assertEqual(len(ia), alen) # slot values ok? values = [ia[i] for i in range(alen)] self.assertEqual(values, init) # out-of-bounds accesses should be caught with self.assertRaises(IndexError): ia[alen] with self.assertRaises(IndexError): ia[-alen-1] # change the items from operator import setitem new_values = list(range(42, 42+alen)) [setitem(ia, n, new_values[n]) for n in range(alen)] values = [ia[i] for i in range(alen)] self.assertEqual(values, new_values) # are the items initialized to 0? ia = int_array() values = [ia[i] for i in range(alen)] self.assertEqual(values, [0] * alen) # Too many initializers should be caught self.assertRaises(IndexError, int_array, *range(alen*2)) CharArray = ARRAY(c_char, 3) ca = CharArray(b"a", b"b", b"c") # Should this work? It doesn't: # CharArray("abc") self.assertRaises(TypeError, CharArray, "abc") self.assertEqual(ca[0], b"a") self.assertEqual(ca[1], b"b") self.assertEqual(ca[2], b"c") self.assertEqual(ca[-3], b"a") self.assertEqual(ca[-2], b"b") self.assertEqual(ca[-1], b"c") self.assertEqual(len(ca), 3) # cannot delete items from operator import delitem self.assertRaises(TypeError, delitem, ca, 0) def test_numeric_arrays(self): alen = 5 numarray = ARRAY(c_int, alen) na = numarray() values = [na[i] for i in range(alen)] self.assertEqual(values, [0] * alen) na = numarray(*[c_int()] * alen) values = [na[i] for i in range(alen)] self.assertEqual(values, [0]*alen) na = numarray(1, 2, 3, 4, 5) values = [i for i in na] self.assertEqual(values, [1, 2, 3, 4, 5]) na = numarray(*map(c_int, (1, 2, 3, 4, 5))) values = [i for i in na] self.assertEqual(values, [1, 2, 3, 4, 5]) def test_classcache(self): self.assertIsNot(ARRAY(c_int, 3), ARRAY(c_int, 4)) self.assertIs(ARRAY(c_int, 3), ARRAY(c_int, 3)) def test_from_address(self): # Failed with 0.9.8, reported by JUrner p = create_string_buffer(b"foo") sz = (c_char * 3).from_address(addressof(p)) self.assertEqual(sz[:], b"foo") self.assertEqual(sz[::], b"foo") self.assertEqual(sz[::-1], b"oof") self.assertEqual(sz[::3], b"f") self.assertEqual(sz[1:4:2], b"o") self.assertEqual(sz.value, b"foo") @need_symbol('create_unicode_buffer') def test_from_addressW(self): p = create_unicode_buffer("foo") sz = (c_wchar * 3).from_address(addressof(p)) self.assertEqual(sz[:], "foo") self.assertEqual(sz[::], "foo") self.assertEqual(sz[::-1], "oof") self.assertEqual(sz[::3], "f") self.assertEqual(sz[1:4:2], "o") self.assertEqual(sz.value, "foo") def test_cache(self): # Array types are cached internally in the _ctypes extension, # in a WeakValueDictionary. Make sure the array type is # removed from the cache when the itemtype goes away. This # test will not fail, but will show a leak in the testsuite. # Create a new type: class my_int(c_int): pass # Create a new array type based on it: t1 = my_int * 1 t2 = my_int * 1 self.assertIs(t1, t2) def test_subclass(self): class T(Array): _type_ = c_int _length_ = 13 class U(T): pass class V(U): pass class W(V): pass class X(T): _type_ = c_short class Y(T): _length_ = 187 for c in [T, U, V, W]: self.assertEqual(c._type_, c_int) self.assertEqual(c._length_, 13) self.assertEqual(c()._type_, c_int) self.assertEqual(c()._length_, 13) self.assertEqual(X._type_, c_short) self.assertEqual(X._length_, 13) self.assertEqual(X()._type_, c_short) self.assertEqual(X()._length_, 13) self.assertEqual(Y._type_, c_int) self.assertEqual(Y._length_, 187) self.assertEqual(Y()._type_, c_int) self.assertEqual(Y()._length_, 187) def test_bad_subclass(self): import sys with self.assertRaises(AttributeError): class T(Array): pass with self.assertRaises(AttributeError): class T(Array): _type_ = c_int with self.assertRaises(AttributeError): class T(Array): _length_ = 13 with self.assertRaises(OverflowError): class T(Array): _type_ = c_int _length_ = sys.maxsize * 2 with self.assertRaises(AttributeError): class T(Array): _type_ = c_int _length_ = 1.87 if __name__ == '__main__': unittest.main()
Close