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

Delta Between Two Patch Sets: Lib/test/test_compile.py

Issue 16510: Using appropriate checks in tests
Left Patch Set: Created 7 years ago
Right Patch Set: Created 5 years, 10 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/test/test_compileall.py ('k') | Lib/test/test_complex.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 import unittest 1 import unittest
2 import sys 2 import sys
3 import _ast 3 import _ast
4 import types 4 import types
5 from test import support 5 from test import support
6 6
7 class TestSpecifics(unittest.TestCase): 7 class TestSpecifics(unittest.TestCase):
8 8
9 def compile_single(self, source): 9 def compile_single(self, source):
10 compile(source, "<single>", "single") 10 compile(source, "<single>", "single")
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 self.assertEqual(eval(all_one_bits), 4294967295) 191 self.assertEqual(eval(all_one_bits), 4294967295)
192 self.assertEqual(eval("-" + all_one_bits), -4294967295) 192 self.assertEqual(eval("-" + all_one_bits), -4294967295)
193 elif sys.maxsize == 9223372036854775807: 193 elif sys.maxsize == 9223372036854775807:
194 # 64-bit machine 194 # 64-bit machine
195 all_one_bits = '0xffffffffffffffff' 195 all_one_bits = '0xffffffffffffffff'
196 self.assertEqual(eval(all_one_bits), 18446744073709551615) 196 self.assertEqual(eval(all_one_bits), 18446744073709551615)
197 self.assertEqual(eval("-" + all_one_bits), -18446744073709551615) 197 self.assertEqual(eval("-" + all_one_bits), -18446744073709551615)
198 else: 198 else:
199 self.fail("How many bits *does* this machine have???") 199 self.fail("How many bits *does* this machine have???")
200 # Verify treatment of constant folding on -(sys.maxsize+1) 200 # Verify treatment of constant folding on -(sys.maxsize+1)
201 # i.e. -2147483648 on 32 bit platforms. Should return int, not long. 201 # i.e. -2147483648 on 32 bit platforms. Should return int.
202 self.assertIsInstance(eval("%s" % (-sys.maxsize - 1)), int) 202 self.assertIsInstance(eval("%s" % (-sys.maxsize - 1)), int)
203 self.assertIsInstance(eval("%s" % (-sys.maxsize - 2)), int) 203 self.assertIsInstance(eval("%s" % (-sys.maxsize - 2)), int)
204 204
205 if sys.maxsize == 9223372036854775807: 205 if sys.maxsize == 9223372036854775807:
206 def test_32_63_bit_values(self): 206 def test_32_63_bit_values(self):
207 a = +4294967296 # 1 << 32 207 a = +4294967296 # 1 << 32
208 b = -4294967296 # 1 << 32 208 b = -4294967296 # 1 << 32
209 c = +281474976710656 # 1 << 48 209 c = +281474976710656 # 1 << 48
210 d = -281474976710656 # 1 << 48 210 d = -281474976710656 # 1 << 48
211 e = +4611686018427387904 # 1 << 62 211 e = +4611686018427387904 # 1 << 62
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 check_limit("a", ".b") 499 check_limit("a", ".b")
500 check_limit("a", "[0]") 500 check_limit("a", "[0]")
501 check_limit("a", "*a") 501 check_limit("a", "*a")
502 502
503 503
504 def test_main(): 504 def test_main():
505 support.run_unittest(TestSpecifics) 505 support.run_unittest(TestSpecifics)
506 506
507 if __name__ == "__main__": 507 if __name__ == "__main__":
508 test_main() 508 test_main()
LEFTRIGHT

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