MCPcopy Index your code
hub / github.com/nonebot/nonebot2 / test_is_gen_callable

Function test_is_gen_callable

tests/test_utils.py:90–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88
89
90def test_is_gen_callable():
91 def test1():
92 yield
93
94 async def test2():
95 yield
96
97 def test3(): ...
98
99 class TestClass1:
100 def __call__(self):
101 yield
102
103 class TestClass2:
104 async def __call__(self):
105 yield
106
107 class TestClass3:
108 def __call__(self): ...
109
110 assert is_gen_callable(test1)
111 assert not is_gen_callable(test2)
112 assert not is_gen_callable(test3)
113 assert is_gen_callable(TestClass1())
114 assert not is_gen_callable(TestClass2())
115 assert not is_gen_callable(TestClass3())
116
117
118def test_is_async_gen_callable():

Callers

nothing calls this directly

Calls 4

is_gen_callableFunction · 0.90
TestClass1Class · 0.85
TestClass2Class · 0.85
TestClass3Class · 0.85

Tested by

no test coverage detected