| OLD | NEW |
| 1 #! /usr/bin/env python | 1 #! /usr/bin/env python |
| 2 """Test the arraymodule. | 2 """Test the arraymodule. |
| 3 Roger E. Masse | 3 Roger E. Masse |
| 4 """ | 4 """ |
| 5 | 5 |
| 6 import unittest | 6 import unittest |
| 7 from test import test_support | 7 from test import test_support |
| 8 from weakref import proxy | 8 from weakref import proxy |
| 9 import array, io, math | 9 import array, io, math |
| 10 from pickle import loads, dumps | 10 from pickle import loads, dumps |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 a.fromunicode('') | 761 a.fromunicode('') |
| 762 a.fromunicode('') | 762 a.fromunicode('') |
| 763 a.fromunicode('\x11abc\xff\u1234') | 763 a.fromunicode('\x11abc\xff\u1234') |
| 764 s = a.tounicode() | 764 s = a.tounicode() |
| 765 self.assertEqual(s, '\xa0\xc2\u1234 \x11abc\xff\u1234') | 765 self.assertEqual(s, '\xa0\xc2\u1234 \x11abc\xff\u1234') |
| 766 | 766 |
| 767 s = '\x00="\'a\\b\x80\xff\u0000\u0001\u1234' | 767 s = '\x00="\'a\\b\x80\xff\u0000\u0001\u1234' |
| 768 a = array.array('u', s) | 768 a = array.array('u', s) |
| 769 self.assertEqual( | 769 self.assertEqual( |
| 770 repr(a), | 770 repr(a), |
| 771 "array('u', '\\x00=\"\\'a\\\\b\\x80\\xff\\x00\\x01\\u1234')") | 771 "array('u', '\\x00=\"\\'a\\\\b\\x80\xff\\x00\\x01\u1234')") |
| 772 | 772 |
| 773 self.assertRaises(TypeError, a.fromunicode) | 773 self.assertRaises(TypeError, a.fromunicode) |
| 774 | 774 |
| 775 tests.append(UnicodeTest) | 775 tests.append(UnicodeTest) |
| 776 | 776 |
| 777 class NumberTest(BaseTest): | 777 class NumberTest(BaseTest): |
| 778 | 778 |
| 779 def test_extslice(self): | 779 def test_extslice(self): |
| 780 a = array.array(self.typecode, range(5)) | 780 a = array.array(self.typecode, range(5)) |
| 781 self.assertEqual(a[::], a) | 781 self.assertEqual(a[::], a) |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 import gc | 974 import gc |
| 975 counts = [None] * 5 | 975 counts = [None] * 5 |
| 976 for i in range(len(counts)): | 976 for i in range(len(counts)): |
| 977 test_support.run_unittest(*tests) | 977 test_support.run_unittest(*tests) |
| 978 gc.collect() | 978 gc.collect() |
| 979 counts[i] = sys.gettotalrefcount() | 979 counts[i] = sys.gettotalrefcount() |
| 980 print(counts) | 980 print(counts) |
| 981 | 981 |
| 982 if __name__ == "__main__": | 982 if __name__ == "__main__": |
| 983 test_main(verbose=True) | 983 test_main(verbose=True) |
| OLD | NEW |