def test_forward_ref_in_annotation(self): A = forwardref('A') def f(a: A) -> A: return a self.assertEqual(A.name, 'A') class A: pass
def test_forward_ref_in_annotation(self): A = forwardref(u'A') def f(a): return a self.assertEqual(A.name, u'A') class A(object): pass
def test_forward_ref_in_overload(self): A = forwardref('A') @overload def f(a:A): return 1 @overload def f(a): return 2 class A: pass self.assertEqual(f(A()), 1) self.assertEqual(f(object()), 2)
def test_forward_ref_in_overload(self): A = forwardref(u'A') @overload def f(a): return 1 @overload def f(a): return 2 class A(object): pass self.assertEqual(f(A()), 1) self.assertEqual(f(object()), 2)
def test_forward_ref_in_annotation(self): A = forwardref('A') def f(a:A) -> A: return a self.assertEqual(A.name, 'A') class A: pass