File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1111 _encode_body ,
1212 _get_header_value ,
1313 _get_page_content ,
14+ _maybe_await ,
1415)
1516
1617
@@ -142,3 +143,17 @@ async def test_get_header_exception(self):
142143 resource .header_value .side_effect = Exception ("nope" )
143144 assert await _get_header_value (resource , "asdf" ) is None
144145 assert await _get_header_value (resource , "qwerty" ) is None
146+
147+
148+ class TestMaybeAwait (IsolatedAsyncioTestCase ):
149+ @pytest .mark .asyncio
150+ async def test_maybe_await (self ):
151+ async def _awaitable_identity (x ):
152+ return x
153+
154+ assert await _maybe_await (_awaitable_identity ("asdf" )) == "asdf"
155+ assert await _maybe_await (_awaitable_identity ("qwerty" )) == "qwerty"
156+ assert await _maybe_await (_awaitable_identity (1234 )) == 1234
157+ assert await _maybe_await ("foo" ) == "foo"
158+ assert await _maybe_await ("bar" ) == "bar"
159+ assert await _maybe_await (1234 ) == 1234
You can’t perform that action at this time.
0 commit comments