Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(254711)

Side by Side Diff: Lib/test/test_sys.py

Issue 13411: Hashable memoryviews
Patch Set: Created 7 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_memoryview.py ('k') | Objects/bytesobject.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import unittest, test.support 1 import unittest, test.support
2 import sys, io, os 2 import sys, io, os
3 import struct 3 import struct
4 import subprocess 4 import subprocess
5 import textwrap 5 import textwrap
6 import warnings 6 import warnings
7 import operator 7 import operator
8 import codecs 8 import codecs
9 9
10 # count the number of test runs, used to create unique 10 # count the number of test runs, used to create unique
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 # listreverseiterator (list) 763 # listreverseiterator (list)
764 check(reversed([]), size(h + 'lP')) 764 check(reversed([]), size(h + 'lP'))
765 # long 765 # long
766 check(0, size(vh)) 766 check(0, size(vh))
767 check(1, size(vh) + self.longdigit) 767 check(1, size(vh) + self.longdigit)
768 check(-1, size(vh) + self.longdigit) 768 check(-1, size(vh) + self.longdigit)
769 PyLong_BASE = 2**sys.int_info.bits_per_digit 769 PyLong_BASE = 2**sys.int_info.bits_per_digit
770 check(int(PyLong_BASE), size(vh) + 2*self.longdigit) 770 check(int(PyLong_BASE), size(vh) + 2*self.longdigit)
771 check(int(PyLong_BASE**2-1), size(vh) + 2*self.longdigit) 771 check(int(PyLong_BASE**2-1), size(vh) + 2*self.longdigit)
772 check(int(PyLong_BASE**2), size(vh) + 3*self.longdigit) 772 check(int(PyLong_BASE**2), size(vh) + 3*self.longdigit)
773 # memory 773 # memory (Py_buffer + hash value)
774 check(memoryview(b''), size(h + 'PP2P2i7P')) 774 check(memoryview(b''), size(h + 'PP2P2i7P' + 'P'))
775 # module 775 # module
776 check(unittest, size(h + '3P')) 776 check(unittest, size(h + '3P'))
777 # None 777 # None
778 check(None, size(h + '')) 778 check(None, size(h + ''))
779 # NotImplementedType 779 # NotImplementedType
780 check(NotImplemented, size(h)) 780 check(NotImplemented, size(h))
781 # object 781 # object
782 check(object(), size(h + '')) 782 check(object(), size(h + ''))
783 # property (descriptor object) 783 # property (descriptor object)
784 class C(object): 784 class C(object):
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 # XXX 894 # XXX
895 # sys.flags 895 # sys.flags
896 check(sys.flags, size(vh) + self.P * len(sys.flags)) 896 check(sys.flags, size(vh) + self.P * len(sys.flags))
897 897
898 898
899 def test_main(): 899 def test_main():
900 test.support.run_unittest(SysModuleTest, SizeofTest) 900 test.support.run_unittest(SysModuleTest, SizeofTest)
901 901
902 if __name__ == "__main__": 902 if __name__ == "__main__":
903 test_main() 903 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_memoryview.py ('k') | Objects/bytesobject.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+