this repo has no description
at trunk 43 lines 1.2 kB view raw
1#!/usr/bin/env python3 2# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) 3import unittest 4import warnings 5 6 7class AttributesTest(unittest.TestCase): 8 def test_cr_running(self): 9 async def coro(): 10 return 1 11 12 # TODO(bsimmers): Test more once we have coroutine.__await__() 13 cr = coro() 14 self.assertFalse(cr.cr_running) 15 # TODO(T42623564): Remove this warning filter and call cr.close(). 16 warnings.filterwarnings( 17 action="ignore", 18 category=RuntimeWarning, 19 message="coroutine.*was never awaited", 20 ) 21 22 23class MethodTest(unittest.TestCase): 24 def test_dunder_repr(self): 25 async def foo(): 26 return 5 27 28 cr = foo() 29 # TODO(T42623564): Remove this warning filter and call cr.close(). 30 warnings.filterwarnings( 31 action="ignore", 32 category=RuntimeWarning, 33 message="coroutine.*was never awaited", 34 ) 35 self.assertTrue( 36 cr.__repr__().startswith( 37 "<coroutine object MethodTest.test_dunder_repr.<locals>.foo at " 38 ) 39 ) 40 41 42if __name__ == "__main__": 43 unittest.main()