MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_switchinterval

Method test_switchinterval

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

Source from the content-addressed store, hash-verified

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