MCPcopy Index your code
hub / github.com/python/cpython / test_switchinterval

Method test_switchinterval

Lib/test/test_sys.py:320–333  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

318 # testing sys.setprofile() is done in test_sys_setprofile.py
319
320 def test_switchinterval(self):
321 self.assertRaises(TypeError, sys.setswitchinterval)
322 self.assertRaises(TypeError, sys.setswitchinterval, "a")
323 self.assertRaises(ValueError, sys.setswitchinterval, -1.0)
324 self.assertRaises(ValueError, sys.setswitchinterval, 0.0)
325 orig = sys.getswitchinterval()
326 # sanity check
327 self.assertTrue(orig < 0.5, orig)
328 try:
329 for n in 0.00001, 0.05, 3.0, orig:
330 sys.setswitchinterval(n)
331 self.assertAlmostEqual(sys.getswitchinterval(), n)
332 finally:
333 sys.setswitchinterval(orig)
334
335 def test_getrecursionlimit(self):
336 limit = sys.getrecursionlimit()

Callers

nothing calls this directly

Calls 3

assertTrueMethod · 0.80
assertRaisesMethod · 0.45
assertAlmostEqualMethod · 0.45

Tested by

no test coverage detected