Esempio n. 1
0
    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
Esempio n. 2
0
    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
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)
Esempio n. 5
0
 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
Esempio n. 6
0
 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