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

Method test_tool

Lib/test/test_monitoring.py:76–89  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

74 m.events.NO_EVENTS
75
76 def test_tool(self):
77 sys.monitoring.use_tool_id(TEST_TOOL, "MonitoringTest.Tool")
78 self.assertEqual(sys.monitoring.get_tool(TEST_TOOL), "MonitoringTest.Tool")
79 sys.monitoring.set_events(TEST_TOOL, 15)
80 self.assertEqual(sys.monitoring.get_events(TEST_TOOL), 15)
81 sys.monitoring.set_events(TEST_TOOL, 0)
82 with self.assertRaises(ValueError):
83 sys.monitoring.set_events(TEST_TOOL, sys.monitoring.events.C_RETURN)
84 with self.assertRaises(ValueError):
85 sys.monitoring.set_events(TEST_TOOL, sys.monitoring.events.C_RAISE)
86 sys.monitoring.free_tool_id(TEST_TOOL)
87 self.assertEqual(sys.monitoring.get_tool(TEST_TOOL), None)
88 with self.assertRaises(ValueError):
89 sys.monitoring.set_events(TEST_TOOL, sys.monitoring.events.CALL)
90
91 def test_clear(self):
92 events = []

Callers

nothing calls this directly

Calls 3

assertEqualMethod · 0.45
get_eventsMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected