Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_sys.SysModuleTest Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_original_displayhook
def test_lost_displayhook
def test_custom_displayhook
def test_original_excepthook
def test_excepthook
def test_exit
def test_getdefaultencoding
def test_setcheckinterval
def test_switchinterval
def test_recursionlimit
def test_recursionlimit_recovery
def test_recursionlimit_fatalerror
def test_getwindowsversion
def test_call_tracing
def test_dlopenflags
def test_refcount
def test_getframe
def test_current_frames
def current_frames_with_threads
def current_frames_without_threads
def test_attributes
def test_43581
def test_intern
def test_sys_flags
def test_clear_type_cache
def test_ioencoding
def test_executable
def check_fsencoding
def test_getfilesystemencoding

Public Attributes

 orig_stdout
 orig_stderr
 orig_displayhook

Detailed Description

Definition at line 19 of file test_sys.py.


Member Function Documentation

def test.test_sys.SysModuleTest.check_fsencoding (   self,
  fs_encoding,
  expected = None 
)

Definition at line 551 of file test_sys.py.

00551 
00552     def check_fsencoding(self, fs_encoding, expected=None):
00553         self.assertIsNotNone(fs_encoding)
00554         codecs.lookup(fs_encoding)
00555         if expected:
00556             self.assertEqual(fs_encoding, expected)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 344 of file test_sys.py.

00344 
00345     def current_frames_with_threads(self):
00346         import threading, _thread
00347         import traceback
00348 
00349         # Spawn a thread that blocks at a known place.  Then the main
00350         # thread does sys._current_frames(), and verifies that the frames
00351         # returned make sense.
00352         entered_g = threading.Event()
00353         leave_g = threading.Event()
00354         thread_info = []  # the thread's id
00355 
00356         def f123():
00357             g456()
00358 
00359         def g456():
00360             thread_info.append(_thread.get_ident())
00361             entered_g.set()
00362             leave_g.wait()
00363 
00364         t = threading.Thread(target=f123)
00365         t.start()
00366         entered_g.wait()
00367 
00368         # At this point, t has finished its entered_g.set(), although it's
00369         # impossible to guess whether it's still on that line or has moved on
00370         # to its leave_g.wait().
00371         self.assertEqual(len(thread_info), 1)
00372         thread_id = thread_info[0]
00373 
00374         d = sys._current_frames()
00375 
00376         main_id = _thread.get_ident()
00377         self.assertIn(main_id, d)
00378         self.assertIn(thread_id, d)
00379 
00380         # Verify that the captured main-thread frame is _this_ frame.
00381         frame = d.pop(main_id)
00382         self.assertTrue(frame is sys._getframe())
00383 
00384         # Verify that the captured thread frame is blocked in g456, called
00385         # from f123.  This is a litte tricky, since various bits of
00386         # threading.py are also in the thread's call stack.
00387         frame = d.pop(thread_id)
00388         stack = traceback.extract_stack(frame)
00389         for i, (filename, lineno, funcname, sourceline) in enumerate(stack):
00390             if funcname == "f123":
00391                 break
00392         else:
00393             self.fail("didn't find f123() on thread's call stack")
00394 
00395         self.assertEqual(sourceline, "g456()")
00396 
00397         # And the next record must be for g456().
00398         filename, lineno, funcname, sourceline = stack[i+1]
00399         self.assertEqual(funcname, "g456")
00400         self.assertIn(sourceline, ["leave_g.wait()", "entered_g.set()"])
00401 
00402         # Reap the spawned thread.
00403         leave_g.set()
00404         t.join()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 406 of file test_sys.py.

00406 
00407     def current_frames_without_threads(self):
00408         # Not much happens here:  there is only one thread, with artificial
00409         # "thread id" 0.
00410         d = sys._current_frames()
00411         self.assertEqual(len(d), 1)
00412         self.assertIn(0, d)
00413         self.assertTrue(d[0] is sys._getframe())

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 21 of file test_sys.py.

00021 
00022     def setUp(self):
00023         self.orig_stdout = sys.stdout
00024         self.orig_stderr = sys.stderr
00025         self.orig_displayhook = sys.displayhook

Here is the caller graph for this function:

Definition at line 26 of file test_sys.py.

00026 
00027     def tearDown(self):
00028         sys.stdout = self.orig_stdout
00029         sys.stderr = self.orig_stderr
00030         sys.displayhook = self.orig_displayhook
00031         test.support.reap_children()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 476 of file test_sys.py.

00476 
00477     def test_43581(self):
00478         # Can't use sys.stdout, as this is a StringIO object when
00479         # the test runs under regrtest.
00480         self.assertEqual(sys.__stdout__.encoding, sys.__stderr__.encoding)

Here is the call graph for this function:

Definition at line 414 of file test_sys.py.

00414 
00415     def test_attributes(self):
00416         self.assertIsInstance(sys.api_version, int)
00417         self.assertIsInstance(sys.argv, list)
00418         self.assertIn(sys.byteorder, ("little", "big"))
00419         self.assertIsInstance(sys.builtin_module_names, tuple)
00420         self.assertIsInstance(sys.copyright, str)
00421         self.assertIsInstance(sys.exec_prefix, str)
00422         self.assertIsInstance(sys.executable, str)
00423         self.assertEqual(len(sys.float_info), 11)
00424         self.assertEqual(sys.float_info.radix, 2)
00425         self.assertEqual(len(sys.int_info), 2)
00426         self.assertTrue(sys.int_info.bits_per_digit % 5 == 0)
00427         self.assertTrue(sys.int_info.sizeof_digit >= 1)
00428         self.assertEqual(type(sys.int_info.bits_per_digit), int)
00429         self.assertEqual(type(sys.int_info.sizeof_digit), int)
00430         self.assertIsInstance(sys.hexversion, int)
00431 
00432         self.assertEqual(len(sys.hash_info), 5)
00433         self.assertLess(sys.hash_info.modulus, 2**sys.hash_info.width)
00434         # sys.hash_info.modulus should be a prime; we do a quick
00435         # probable primality test (doesn't exclude the possibility of
00436         # a Carmichael number)
00437         for x in range(1, 100):
00438             self.assertEqual(
00439                 pow(x, sys.hash_info.modulus-1, sys.hash_info.modulus),
00440                 1,
00441                 "sys.hash_info.modulus {} is a non-prime".format(
00442                     sys.hash_info.modulus)
00443                 )
00444         self.assertIsInstance(sys.hash_info.inf, int)
00445         self.assertIsInstance(sys.hash_info.nan, int)
00446         self.assertIsInstance(sys.hash_info.imag, int)
00447 
00448         self.assertIsInstance(sys.maxsize, int)
00449         self.assertIsInstance(sys.maxunicode, int)
00450         self.assertIsInstance(sys.platform, str)
00451         self.assertIsInstance(sys.prefix, str)
00452         self.assertIsInstance(sys.version, str)
00453         vi = sys.version_info
00454         self.assertIsInstance(vi[:], tuple)
00455         self.assertEqual(len(vi), 5)
00456         self.assertIsInstance(vi[0], int)
00457         self.assertIsInstance(vi[1], int)
00458         self.assertIsInstance(vi[2], int)
00459         self.assertIn(vi[3], ("alpha", "beta", "candidate", "final"))
00460         self.assertIsInstance(vi[4], int)
00461         self.assertIsInstance(vi.major, int)
00462         self.assertIsInstance(vi.minor, int)
00463         self.assertIsInstance(vi.micro, int)
00464         self.assertIn(vi.releaselevel, ("alpha", "beta", "candidate", "final"))
00465         self.assertIsInstance(vi.serial, int)
00466         self.assertEqual(vi[0], vi.major)
00467         self.assertEqual(vi[1], vi.minor)
00468         self.assertEqual(vi[2], vi.micro)
00469         self.assertEqual(vi[3], vi.releaselevel)
00470         self.assertEqual(vi[4], vi.serial)
00471         self.assertTrue(vi > (1,0,0))
00472         self.assertIsInstance(sys.float_repr_style, str)
00473         self.assertIn(sys.float_repr_style, ('short', 'legacy'))
00474         if not sys.platform.startswith('win'):
00475             self.assertIsInstance(sys.abiflags, str)

Here is the call graph for this function:

Definition at line 293 of file test_sys.py.

00293 
00294     def test_call_tracing(self):
00295         self.assertRaises(TypeError, sys.call_tracing, type, 2)

Here is the call graph for this function:

Definition at line 513 of file test_sys.py.

00513 
00514     def test_clear_type_cache(self):
00515         sys._clear_type_cache()

Definition at line 330 of file test_sys.py.

00330 
00331     def test_current_frames(self):
00332         have_threads = True
00333         try:
00334             import _thread
00335         except ImportError:
00336             have_threads = False
00337 
00338         if have_threads:
00339             self.current_frames_with_threads()
00340         else:
00341             self.current_frames_without_threads()

Here is the call graph for this function:

Definition at line 58 of file test_sys.py.

00058 
00059     def test_custom_displayhook(self):
00060         def baddisplayhook(obj):
00061             raise ValueError
00062         sys.displayhook = baddisplayhook
00063         code = compile("42", "<string>", "single")
00064         self.assertRaises(ValueError, eval, code)

Here is the call graph for this function:

Definition at line 296 of file test_sys.py.

00296 
00297     def test_dlopenflags(self):
00298         if hasattr(sys, "setdlopenflags"):
00299             self.assertTrue(hasattr(sys, "getdlopenflags"))
00300             self.assertRaises(TypeError, sys.getdlopenflags, 42)
00301             oldflags = sys.getdlopenflags()
00302             self.assertRaises(TypeError, sys.setdlopenflags)
00303             sys.setdlopenflags(oldflags+1)
00304             self.assertEqual(sys.getdlopenflags(), oldflags+1)
00305             sys.setdlopenflags(oldflags)

Here is the call graph for this function:

Definition at line 79 of file test_sys.py.

00079 
00080     def test_excepthook(self):
00081         with test.support.captured_output("stderr") as stderr:
00082             sys.excepthook(1, '1', 1)
00083         self.assertTrue("TypeError: print_exception(): Exception expected for " \
00084                          "value, str found" in stderr.getvalue())

Here is the call graph for this function:

Definition at line 534 of file test_sys.py.

00534 
00535     def test_executable(self):
00536         # Issue #7774: Ensure that sys.executable is an empty string if argv[0]
00537         # has been set to an non existent program name and Python is unable to
00538         # retrieve the real program name
00539 
00540         # For a normal installation, it should work without 'cwd'
00541         # argument. For test runs in the build directory, see #7774.
00542         python_dir = os.path.dirname(os.path.realpath(sys.executable))
00543         p = subprocess.Popen(
00544             ["nonexistent", "-c",
00545              'import sys; print(sys.executable.encode("ascii", "backslashreplace"))'],
00546             executable=sys.executable, stdout=subprocess.PIPE, cwd=python_dir)
00547         stdout = p.communicate()[0]
00548         executable = stdout.strip().decode("ASCII")
00549         p.wait()
00550         self.assertIn(executable, ["b''", repr(sys.executable.encode("ascii", "backslashreplace"))])

Here is the call graph for this function:

Definition at line 88 of file test_sys.py.

00088 
00089     def test_exit(self):
00090 
00091         self.assertRaises(TypeError, sys.exit, 42, 42)
00092 
00093         # call without argument
00094         try:
00095             sys.exit(0)
00096         except SystemExit as exc:
00097             self.assertEqual(exc.code, 0)
00098         except:
00099             self.fail("wrong exception")
00100         else:
00101             self.fail("no exception")
00102 
00103         # call with tuple argument with one entry
00104         # entry will be unpacked
00105         try:
00106             sys.exit(42)
00107         except SystemExit as exc:
00108             self.assertEqual(exc.code, 42)
00109         except:
00110             self.fail("wrong exception")
00111         else:
00112             self.fail("no exception")
00113 
00114         # call with integer argument
00115         try:
00116             sys.exit((42,))
00117         except SystemExit as exc:
00118             self.assertEqual(exc.code, 42)
00119         except:
00120             self.fail("wrong exception")
00121         else:
00122             self.fail("no exception")
00123 
00124         # call with string argument
00125         try:
00126             sys.exit("exit")
00127         except SystemExit as exc:
00128             self.assertEqual(exc.code, "exit")
00129         except:
00130             self.fail("wrong exception")
00131         else:
00132             self.fail("no exception")
00133 
00134         # call with tuple argument with two entries
00135         try:
00136             sys.exit((17, 23))
00137         except SystemExit as exc:
00138             self.assertEqual(exc.code, (17, 23))
00139         except:
00140             self.fail("wrong exception")
00141         else:
00142             self.fail("no exception")
00143 
00144         # test that the exit machinery handles SystemExits properly
00145         rc = subprocess.call([sys.executable, "-c",
00146                               "raise SystemExit(47)"])
00147         self.assertEqual(rc, 47)
00148 
00149         def check_exit_message(code, expected, env=None):
00150             process = subprocess.Popen([sys.executable, "-c", code],
00151                                        stderr=subprocess.PIPE, env=env)
00152             stdout, stderr = process.communicate()
00153             self.assertEqual(process.returncode, 1)
00154             self.assertTrue(stderr.startswith(expected),
00155                 "%s doesn't start with %s" % (ascii(stderr), ascii(expected)))
00156 
00157         # test that stderr buffer if flushed before the exit message is written
00158         # into stderr
00159         check_exit_message(
00160             r'import sys; sys.stderr.write("unflushed,"); sys.exit("message")',
00161             b"unflushed,message")
00162 
00163         # test that the exit message is written with backslashreplace error
00164         # handler to stderr
00165         check_exit_message(
00166             r'import sys; sys.exit("surrogates:\uDCFF")',
00167             b"surrogates:\\udcff")
00168 
00169         # test that the unicode message is encoded to the stderr encoding
00170         # instead of the default encoding (utf8)
00171         env = os.environ.copy()
00172         env['PYTHONIOENCODING'] = 'latin-1'
00173         check_exit_message(
00174             r'import sys; sys.exit("h\xe9")',
00175             b"h\xe9", env=env)

Here is the call graph for this function:

Definition at line 176 of file test_sys.py.

00176 
00177     def test_getdefaultencoding(self):
00178         self.assertRaises(TypeError, sys.getdefaultencoding, 42)
00179         # can't check more than the type, as the user might have changed it
00180         self.assertIsInstance(sys.getdefaultencoding(), str)

Here is the call graph for this function:

Definition at line 557 of file test_sys.py.

00557 
00558     def test_getfilesystemencoding(self):
00559         fs_encoding = sys.getfilesystemencoding()
00560         if sys.platform == 'darwin':
00561             expected = 'utf-8'
00562         elif sys.platform == 'win32':
00563             expected = 'mbcs'
00564         else:
00565             expected = None
00566         self.check_fsencoding(fs_encoding, expected)
00567 

Here is the call graph for this function:

Definition at line 321 of file test_sys.py.

00321 
00322     def test_getframe(self):
00323         self.assertRaises(TypeError, sys._getframe, 42, 42)
00324         self.assertRaises(ValueError, sys._getframe, 2000000000)
00325         self.assertTrue(
00326             SysModuleTest.test_getframe.__code__ \
00327             is sys._getframe().f_code
00328         )

Here is the call graph for this function:

Definition at line 263 of file test_sys.py.

00263 
00264     def test_getwindowsversion(self):
00265         # Raise SkipTest if sys doesn't have getwindowsversion attribute
00266         test.support.get_attribute(sys, "getwindowsversion")
00267         v = sys.getwindowsversion()
00268         self.assertEqual(len(v), 5)
00269         self.assertIsInstance(v[0], int)
00270         self.assertIsInstance(v[1], int)
00271         self.assertIsInstance(v[2], int)
00272         self.assertIsInstance(v[3], int)
00273         self.assertIsInstance(v[4], str)
00274         self.assertRaises(IndexError, operator.getitem, v, 5)
00275         self.assertIsInstance(v.major, int)
00276         self.assertIsInstance(v.minor, int)
00277         self.assertIsInstance(v.build, int)
00278         self.assertIsInstance(v.platform, int)
00279         self.assertIsInstance(v.service_pack, str)
00280         self.assertIsInstance(v.service_pack_minor, int)
00281         self.assertIsInstance(v.service_pack_major, int)
00282         self.assertIsInstance(v.suite_mask, int)
00283         self.assertIsInstance(v.product_type, int)
00284         self.assertEqual(v[0], v.major)
00285         self.assertEqual(v[1], v.minor)
00286         self.assertEqual(v[2], v.build)
00287         self.assertEqual(v[3], v.platform)
00288         self.assertEqual(v[4], v.service_pack)
00289 
00290         # This is how platform.py calls it. Make sure tuple
00291         #  still has 5 elements
00292         maj, min, buildno, plat, csd = sys.getwindowsversion()

Here is the call graph for this function:

Definition at line 481 of file test_sys.py.

00481 
00482     def test_intern(self):
00483         global numruns
00484         numruns += 1
00485         self.assertRaises(TypeError, sys.intern)
00486         s = "never interned before" + str(numruns)
00487         self.assertTrue(sys.intern(s) is s)
00488         s2 = s.swapcase().swapcase()
00489         self.assertTrue(sys.intern(s2) is s)
00490 
00491         # Subclasses of string can't be interned, because they
00492         # provide too much opportunity for insane things to happen.
00493         # We don't want them in the interned dict and if they aren't
00494         # actually interned, we don't want to create the appearance
00495         # that they are by allowing intern() to succeed.
00496         class S(str):
00497             def __hash__(self):
00498                 return 123
00499 
00500         self.assertRaises(TypeError, sys.intern, S("abc"))

Here is the call graph for this function:

Definition at line 516 of file test_sys.py.

00516 
00517     def test_ioencoding(self):
00518         env = dict(os.environ)
00519 
00520         # Test character: cent sign, encoded as 0x4A (ASCII J) in CP424,
00521         # not representable in ASCII.
00522 
00523         env["PYTHONIOENCODING"] = "cp424"
00524         p = subprocess.Popen([sys.executable, "-c", 'print(chr(0xa2))'],
00525                              stdout = subprocess.PIPE, env=env)
00526         out = p.communicate()[0].strip()
00527         self.assertEqual(out, "\xa2\n".encode("cp424"))
00528 
00529         env["PYTHONIOENCODING"] = "ascii:replace"
00530         p = subprocess.Popen([sys.executable, "-c", 'print(chr(0xa2))'],
00531                              stdout = subprocess.PIPE, env=env)
00532         out = p.communicate()[0].strip()
00533         self.assertEqual(out, b'?')

Here is the call graph for this function:

Definition at line 53 of file test_sys.py.

00053 
00054     def test_lost_displayhook(self):
00055         del sys.displayhook
00056         code = compile("42", "<string>", "single")
00057         self.assertRaises(RuntimeError, eval, code)

Here is the call graph for this function:

Definition at line 32 of file test_sys.py.

00032 
00033     def test_original_displayhook(self):
00034         import builtins
00035         out = io.StringIO()
00036         sys.stdout = out
00037 
00038         dh = sys.__displayhook__
00039 
00040         self.assertRaises(TypeError, dh)
00041         if hasattr(builtins, "_"):
00042             del builtins._
00043 
00044         dh(None)
00045         self.assertEqual(out.getvalue(), "")
00046         self.assertTrue(not hasattr(builtins, "_"))
00047         dh(42)
00048         self.assertEqual(out.getvalue(), "42\n")
00049         self.assertEqual(builtins._, 42)
00050 
00051         del sys.stdout
00052         self.assertRaises(RuntimeError, dh, 42)

Here is the call graph for this function:

Definition at line 65 of file test_sys.py.

00065 
00066     def test_original_excepthook(self):
00067         err = io.StringIO()
00068         sys.stderr = err
00069 
00070         eh = sys.__excepthook__
00071 
00072         self.assertRaises(TypeError, eh)
00073         try:
00074             raise ValueError(42)
00075         except ValueError as exc:
00076             eh(*sys.exc_info())
00077 
00078         self.assertTrue(err.getvalue().endswith("ValueError: 42\n"))

Here is the call graph for this function:

Definition at line 209 of file test_sys.py.

00209 
00210     def test_recursionlimit(self):
00211         self.assertRaises(TypeError, sys.getrecursionlimit, 42)
00212         oldlimit = sys.getrecursionlimit()
00213         self.assertRaises(TypeError, sys.setrecursionlimit)
00214         self.assertRaises(ValueError, sys.setrecursionlimit, -42)
00215         sys.setrecursionlimit(10000)
00216         self.assertEqual(sys.getrecursionlimit(), 10000)
00217         sys.setrecursionlimit(oldlimit)

Here is the call graph for this function:

Definition at line 237 of file test_sys.py.

00237 
00238     def test_recursionlimit_fatalerror(self):
00239         # A fatal error occurs if a second recursion limit is hit when recovering
00240         # from a first one.
00241         if os.name == "nt":
00242             raise unittest.SkipTest(
00243                 "under Windows, test would generate a spurious crash dialog")
00244         code = textwrap.dedent("""
00245             import sys
00246 
00247             def f():
00248                 try:
00249                     f()
00250                 except RuntimeError:
00251                     f()
00252 
00253             sys.setrecursionlimit(%d)
00254             f()""")
00255         for i in (50, 1000):
00256             sub = subprocess.Popen([sys.executable, '-c', code % i],
00257                 stderr=subprocess.PIPE)
00258             err = sub.communicate()[1]
00259             self.assertTrue(sub.returncode, sub.returncode)
00260             self.assertTrue(
00261                 b"Fatal Python error: Cannot recover from stack overflow" in err,
00262                 err)

Here is the call graph for this function:

Definition at line 220 of file test_sys.py.

00220 
00221     def test_recursionlimit_recovery(self):
00222         # NOTE: this test is slightly fragile in that it depends on the current
00223         # recursion count when executing the test being low enough so as to
00224         # trigger the recursion recovery detection in the _Py_MakeEndRecCheck
00225         # macro (see ceval.h).
00226         oldlimit = sys.getrecursionlimit()
00227         def f():
00228             f()
00229         try:
00230             for i in (50, 1000):
00231                 # Issue #5392: stack overflow after hitting recursion limit twice
00232                 sys.setrecursionlimit(i)
00233                 self.assertRaises(RuntimeError, f)
00234                 self.assertRaises(RuntimeError, f)
00235         finally:
00236             sys.setrecursionlimit(oldlimit)

Here is the call graph for this function:

Definition at line 306 of file test_sys.py.

00306 
00307     def test_refcount(self):
00308         # n here must be a global in order for this test to pass while
00309         # tracing with a python function.  Tracing calls PyFrame_FastToLocals
00310         # which will add a copy of any locals to the frame object, causing
00311         # the reference count to increase by 2 instead of 1.
00312         global n
00313         self.assertRaises(TypeError, sys.getrefcount)
00314         c = sys.getrefcount(None)
00315         n = None
00316         self.assertEqual(sys.getrefcount(None), c+1)
00317         del n
00318         self.assertEqual(sys.getrefcount(None), c)
00319         if hasattr(sys, "gettotalrefcount"):
00320             self.assertIsInstance(sys.gettotalrefcount(), int)

Here is the call graph for this function:

Definition at line 184 of file test_sys.py.

00184 
00185     def test_setcheckinterval(self):
00186         with warnings.catch_warnings():
00187             warnings.simplefilter("ignore")
00188             self.assertRaises(TypeError, sys.setcheckinterval)
00189             orig = sys.getcheckinterval()
00190             for n in 0, 100, 120, orig: # orig last to restore starting state
00191                 sys.setcheckinterval(n)
00192                 self.assertEqual(sys.getcheckinterval(), n)

Here is the call graph for this function:

Definition at line 194 of file test_sys.py.

00194 
00195     def test_switchinterval(self):
00196         self.assertRaises(TypeError, sys.setswitchinterval)
00197         self.assertRaises(TypeError, sys.setswitchinterval, "a")
00198         self.assertRaises(ValueError, sys.setswitchinterval, -1.0)
00199         self.assertRaises(ValueError, sys.setswitchinterval, 0.0)
00200         orig = sys.getswitchinterval()
00201         # sanity check
00202         self.assertTrue(orig < 0.5, orig)
00203         try:
00204             for n in 0.00001, 0.05, 3.0, orig:
00205                 sys.setswitchinterval(n)
00206                 self.assertAlmostEqual(sys.getswitchinterval(), n)
00207         finally:
00208             sys.setswitchinterval(orig)

Here is the call graph for this function:

Definition at line 501 of file test_sys.py.

00501 
00502     def test_sys_flags(self):
00503         self.assertTrue(sys.flags)
00504         attrs = ("debug", "division_warning",
00505                  "inspect", "interactive", "optimize", "dont_write_bytecode",
00506                  "no_user_site", "no_site", "ignore_environment", "verbose",
00507                  "bytes_warning", "quiet")
00508         for attr in attrs:
00509             self.assertTrue(hasattr(sys.flags, attr), attr)
00510             self.assertEqual(type(getattr(sys.flags, attr)), int, attr)
00511         self.assertTrue(repr(sys.flags))
00512         self.assertEqual(len(sys.flags), len(attrs))

Here is the call graph for this function:


Member Data Documentation

Definition at line 24 of file test_sys.py.

Definition at line 23 of file test_sys.py.

Definition at line 22 of file test_sys.py.


The documentation for this class was generated from the following file: