Lines Matching defs:sys
17 import sys
90 (repr(sys.maxsize), sys.maxsize),
112 (repr(sys.maxsize), sys.maxsize),
157 __import__('sys')
160 __import__(name='sys')
165 self.assertRaises(TypeError, __import__, 'sys', name='sys')
179 self.assertTrue(abs(-sys.maxsize-1) > 0)
263 x = -sys.maxsize-1
265 self.assertEqual(-x, sys.maxsize+1)
307 self.assertEqual(chr(sys.maxunicode),
512 sys.spam = 1
513 delattr(sys, 'spam')
515 self.assertRaises(TypeError, delattr, sys)
517 self.assertRaisesRegex(TypeError, msg, delattr, sys, 1)
528 self.assertIn('exit', dir(sys))
602 self.assertEqual(divmod(-sys.maxsize-1, -1), (sys.maxsize+1, 0))
802 savestdout = sys.stdout
803 sys.stdout = None # Whatever that cannot flush()
810 sys.stdout = savestdout
932 self.assertTrue(getattr(sys, 'stdout') is sys.stdout)
934 self.assertRaises(TypeError, getattr, sys)
936 self.assertRaisesRegex(TypeError, msg, getattr, sys, 1)
937 self.assertRaisesRegex(TypeError, msg, getattr, sys, 1, 'spam')
938 self.assertRaises(AttributeError, getattr, sys, chr(sys.maxunicode))
943 self.assertTrue(hasattr(sys, 'stdout'))
945 self.assertRaises(TypeError, hasattr, sys)
947 self.assertRaisesRegex(TypeError, msg, hasattr, sys, 1)
948 self.assertEqual(False, hasattr(sys, chr(sys.maxunicode)))
1068 return sys.maxsize + 1
1072 return -sys.maxsize-10
1320 @unittest.skipIf(sys.flags.utf8_mode, "utf-8 mode is enabled")
1361 self.assertEqual(ord(chr(sys.maxunicode)), sys.maxunicode)
1440 savestdin = sys.stdin
1441 savestdout = sys.stdout # Eats the echo
1443 sys.stdin = fp
1444 sys.stdout = BitBucket()
1450 # sys.stdout must be a regular file for triggering
1451 sys.stdout = savestdout
1452 sys.stdin.close()
1455 sys.stdout = BitBucket()
1456 sys.stdin = io.StringIO("NULL\0")
1458 sys.stdin = io.StringIO(" 'whitespace'")
1460 sys.stdin = io.StringIO()
1463 del sys.stdout
1465 del sys.stdin
1468 sys.stdin = savestdin
1469 sys.stdout = savestdout
1592 setattr(sys, 'spam', 1)
1593 self.assertEqual(sys.spam, 1)
1595 self.assertRaises(TypeError, setattr, sys)
1596 self.assertRaises(TypeError, setattr, sys, 'spam')
1598 self.assertRaisesRegex(TypeError, msg, setattr, sys, 1, 'spam')
1678 self.assertEqual(set(vars(sys)), set(dir(sys)))
2015 # will mess up these tests. Similarly for sys.breakpointhook.
2024 swap_attr(sys, 'breakpointhook', sys.__breakpointhook__))
2033 sys.breakpointhook = my_breakpointhook
2039 sys.breakpointhook = my_breakpointhook
2043 sys.breakpointhook = sys.__breakpointhook__
2051 sys.breakpointhook = my_breakpointhook
2058 sys.breakpointhook = my_breakpointhook
2061 @unittest.skipIf(sys.flags.ignore_environment, '-E was given')
2068 @unittest.skipIf(sys.flags.ignore_environment, '-E was given')
2070 self.env['PYTHONBREAKPOINT'] = 'sys.exit'
2071 with patch('sys.exit') as mock:
2075 @unittest.skipIf(sys.flags.ignore_environment, '-E was given')
2089 @unittest.skipIf(sys.flags.ignore_environment, '-E was given')
2109 self.env['PYTHONBREAKPOINT'] = 'sys.exit'
2110 with patch('sys.exit') as mock:
2111 sys.breakpointhook = int
2200 if not sys.stdin.isatty() or not sys.stdout.isatty():
2205 sys.stdin = io.TextIOWrapper(sys.stdin.detach(),
2208 sys.stdout = io.TextIOWrapper(sys.stdout.detach(),
2211 print("tty =", sys.stdin.isatty() and sys.stdout.isatty(), file=wpipe)
2222 expected = terminal_input.decode(sys.stdin.encoding) # what else?
2237 if 'readline' in sys.modules:
2254 print("stdin.isatty():", sys.stdin.isatty(), file=wpipe)
2255 sys.stdout = io.StringIO() # Does not support fileno()
2257 print("captured:", ascii(sys.stdout.getvalue()), file=wpipe)
2314 import sys
2324 # Make this module survive until builtins and sys are cleaned
2325 builtins.here = sys.modules[__name__]
2326 sys.here = sys.modules[__name__]
2329 here = sys.modules[__name__]
2334 # "before" to sys.stdout.encoding. For example, on Windows,
2335 # sys.stdout.encoding is the OEM code page and these code pages are