diff options
| author | Mark Shannon <mark@hotpy.org> | 2023-06-02 10:46:18 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-02 10:46:18 (GMT) |
| commit | 4bfa01b9d911ce9358cf1a453bee15554f8e4c07 (patch) | |
| tree | bd61d8459bf30d42abf0be7258de91360bea434b /Lib/test/test_capi/test_misc.py | |
| parent | 601ae09f0c8eda213b9050892f5ce9b91f0aa522 (diff) | |
| download | cpython-4bfa01b9d911ce9358cf1a453bee15554f8e4c07.zip cpython-4bfa01b9d911ce9358cf1a453bee15554f8e4c07.tar.gz cpython-4bfa01b9d911ce9358cf1a453bee15554f8e4c07.tar.bz2 | |
GH-104584: Plugin optimizer API (GH-105100)
Diffstat (limited to 'Lib/test/test_capi/test_misc.py')
| -rw-r--r-- | Lib/test/test_capi/test_misc.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_capi/test_misc.py b/Lib/test/test_capi/test_misc.py index e1b55cf..3a4937c 100644 --- a/Lib/test/test_capi/test_misc.py +++ b/Lib/test/test_capi/test_misc.py @@ -1916,6 +1916,19 @@ class Test_Pep523API(unittest.TestCase): names = ["func", "outer", "outer", "inner", "inner", "outer", "inner"] self.do_test(func, names) +class TestOptimizerAPI(unittest.TestCase): + + def test_counter_optimizer(self): + opt = _testinternalcapi.get_counter_optimizer() + self.assertEqual(opt.get_count(), 0) + try: + _testinternalcapi.set_optimizer(opt) + self.assertEqual(opt.get_count(), 0) + for _ in range(1000): + pass + self.assertEqual(opt.get_count(), 1000) + finally: + _testinternalcapi.set_optimizer(None) if __name__ == "__main__": unittest.main() |
