MCPcopy Index your code
hub / github.com/ipython/ipython / test_should_be_async

Method test_should_be_async

tests/test_async_helpers.py:33–56  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

31
32class AsyncTest(TestCase):
33 def test_should_be_async(self):
34 self.assertFalse(_should_be_async("False"))
35 self.assertTrue(_should_be_async("await bar()"))
36 self.assertTrue(_should_be_async("x = await bar()"))
37 self.assertFalse(
38 _should_be_async(
39 dedent(
40 """
41 async def awaitable():
42 pass
43 """
44 )
45 )
46 )
47
48 self.assertFalse(_should_be_async("return await foo()"))
49 self.assertFalse(_should_be_async("return bar()"))
50 self.assertFalse(_should_be_async("some invalid Python code"))
51
52 self.assertFalse(_should_be_async("'\\ud800'"))
53
54 if sys.version_info >= (3, 13):
55 # Note: the next assert assumes the tests run without the `-OO` flag
56 self.assertFalse(_should_be_async("'\\ud800'\nawait foo"))
57
58 def _get_top_level_cases(self):
59 # These are test cases that should be valid in a function

Callers

nothing calls this directly

Calls 2

_should_be_asyncFunction · 0.90
dedentFunction · 0.85

Tested by

no test coverage detected