Home
last modified time | relevance | path

Searched refs:__annotations__ (Results 1 - 24 of 24) sorted by relevance

/third_party/python/Lib/test/
H A Dtest_type_annotations.py7 # type objects lazy create their __annotations__ dict on demand.
12 self.assertFalse("__annotations__" in foo.__dict__)
13 d = foo.__annotations__
14 self.assertTrue("__annotations__" in foo.__dict__)
15 self.assertEqual(foo.__annotations__, d)
16 self.assertEqual(foo.__dict__['__annotations__'], d)
17 del foo.__annotations__
22 self.assertFalse("__annotations__" in foo.__dict__)
24 foo.__annotations__ = d
25 self.assertTrue("__annotations__" i
60 def __annotations__(self): global() member in TypeAnnotationTests.test_descriptor_still_works.C
68 def __annotations__(self, value): global() member in TypeAnnotationTests.test_descriptor_still_works.C
74 def __annotations__(self): global() member in TypeAnnotationTests.test_descriptor_still_works.C
[all...]
H A Dtest_module.py291 # module objects lazy create their __annotations__ dict on demand.
296 self.assertFalse("__annotations__" in foo.__dict__)
297 d = foo.__annotations__
298 self.assertTrue("__annotations__" in foo.__dict__)
299 self.assertEqual(foo.__annotations__, d)
300 self.assertEqual(foo.__dict__['__annotations__'], d)
302 del foo.__annotations__
304 del foo.__dict__['__annotations__']
309 self.assertFalse("__annotations__" in foo.__dict__)
311 foo.__annotations__
[all...]
H A Dtest_grammar.py14 # different import patterns to check that __annotations__ does not interfere
310 # custom namespace for testing __annotations__
385 self.assertEqual(f.__annotations__, {})
409 self.assertEqual(C.__annotations__, {'_C__foo': int, 's': str})
432 self.assertEqual(A.__annotations__, {"attr": int})
433 self.assertEqual(B.__annotations__, {})
434 self.assertEqual(C.__annotations__, {"attr" : str})
435 self.assertEqual(D.__annotations__, {"attr2" : int})
436 self.assertEqual(E.__annotations__, {})
437 self.assertEqual(F.__annotations__, {})
[all...]
H A Dann_module.py11 __annotations__[1] = 2
22 __annotations__['123'] = 123
H A Dtest_future.py149 func_ret_ann = scope['f'].__annotations__['return']
150 func_arg_ann = scope['g'].__annotations__['arg']
151 async_func_ret_ann = scope['f2'].__annotations__['return']
152 async_func_arg_ann = scope['g2'].__annotations__['arg']
153 var_ann1 = scope['__annotations__']['var']
154 var_ann2 = scope['__annotations__']['var2']
H A Dtest_opcodes.py36 self.assertEqual(C.__annotations__, {})
39 ns = {'__annotations__': {1: 2}}
41 self.assertEqual(ns['__annotations__'], {'x': int, 1: 2})
44 # Don't rely on the existence of the '__annotations__' global.
45 with support.swap_item(globals(), '__annotations__', {}):
46 del globals()['__annotations__']
48 del __annotations__
H A Dann_module3.py7 __annotations__[1] = 2
H A Dann_module2.py25 __annotations__ = {} variable
H A Dtest_positional_only_arg.py305 assert inner_has_pos_only().__annotations__ == {'x': int}
312 assert Something().method().__annotations__ == {'x': int}
320 assert multiple_levels().__annotations__ == {'x': int}
H A Dtest_typing.py1462 self.assertEqual(f.__annotations__, {'args': Unpack[Ts]})
1463 self.assertEqual(g.__annotations__, {'args': (*Ts,)[0]})
1467 self.assertEqual(a.__annotations__,
1471 self.assertEqual(b.__annotations__,
1481 a.__annotations__,
1487 b.__annotations__,
1493 c.__annotations__,
1499 d.__annotations__,
1507 e.__annotations__,
1513 f.__annotations__,
[all...]
H A Dtest_dataclasses.py613 # is in __annotations__.
617 self.assertIn(f.name, C.__annotations__)
816 # First, check __annotations__, even though they're not
818 self.assertEqual(cls.__annotations__['i'], int)
819 self.assertEqual(cls.__annotations__['j'], str)
820 self.assertEqual(cls.__annotations__['k'], F)
821 self.assertEqual(cls.__annotations__['l'], float)
822 self.assertEqual(cls.__annotations__['z'], complex)
934 self.assertEqual(list(C.__annotations__), ['i'])
1121 self.assertEqual(len(C.__annotations__),
[all...]
H A Dtest_inspect.py997 self.assertEqual(test.__annotations__, spec.annotations)
1001 self.assertEqual(test.__annotations__, spec.annotations)
1334 foo.__annotations__ = {'a': 'foo', 'b':'str'}
2629 # __code__, __annotations__, __defaults__, __name__,
2635 self.__annotations__ = func.__annotations__
2689 __annotations__ = func.__annotations__ variable in TestSignatureObject.test_signature_functionlike_class.funclike
3048 ...)) # functools.wraps will copy __annotations__
3669 # __code__, __annotations__, __defaults_
[all...]
H A Dtest_functools.py638 self.assertEqual(wrapper.__annotations__['a'], 'This is a new annotation')
639 self.assertNotIn('b', wrapper.__annotations__)
659 self.assertEqual(wrapper.__annotations__, {})
710 self.assertEqual(wrapper.__annotations__, {})
2610 self.assertEqual(meth.__annotations__['arg'], int)
2699 self.assertEqual(meth.__annotations__['arg'], int)
/third_party/python/Lib/lib2to3/tests/data/
H A Dpy3_test_grammar.py321 self.assertEquals(f.__annotations__, {'return': list})
323 self.assertEquals(f.__annotations__, {'x': int})
325 self.assertEquals(f.__annotations__, {'x': str})
327 self.assertEquals(f.__annotations__, {'x': float})
329 self.assertEquals(f.__annotations__, {'y': 3})
331 self.assertEquals(f.__annotations__, {'b': 1, 'c': 2})
333 self.assertEquals(f.__annotations__,
337 self.assertEquals(f.__annotations__,
344 self.assertEquals(f.__annotations__, {'return': list})
/third_party/python/Objects/
H A Dmoduleobject.c893 if (PyDict_Contains(dict, &_Py_ID(__annotations__))) { in module_get_annotations()
894 annotations = PyDict_GetItemWithError(dict, &_Py_ID(__annotations__)); in module_get_annotations()
907 dict, &_Py_ID(__annotations__), annotations); in module_get_annotations()
930 ret = PyDict_SetItem(dict, &_Py_ID(__annotations__), value); in module_set_annotations()
935 if (!PyDict_Contains(dict, &_Py_ID(__annotations__))) { in module_set_annotations()
936 PyErr_Format(PyExc_AttributeError, "__annotations__"); in module_set_annotations()
940 ret = PyDict_DelItem(dict, &_Py_ID(__annotations__)); in module_set_annotations()
949 {"__annotations__", (getter)module_get_annotations, (setter)module_set_annotations},
H A Dfuncobject.c553 "__annotations__ must be set to a dict object"); in func_set_annotations()
568 {"__annotations__", (getter)func_get_annotations,
833 COPY_ATTR(__annotations__); in functools_wraps()
H A Dtypeobject.c910 PyErr_Format(PyExc_AttributeError, "type object '%s' has no attribute '__annotations__'", type->tp_name); in type_get_annotations()
916 if (PyDict_Contains(type->tp_dict, &_Py_ID(__annotations__))) { in type_get_annotations()
918 type->tp_dict, &_Py_ID(__annotations__)); in type_get_annotations()
936 type->tp_dict, &_Py_ID(__annotations__), annotations); in type_get_annotations()
952 "cannot set '__annotations__' attribute of immutable type '%s'", in type_set_annotations()
960 result = PyDict_SetItem(type->tp_dict, &_Py_ID(__annotations__), value); in type_set_annotations()
963 if (!PyDict_Contains(type->tp_dict, &_Py_ID(__annotations__))) { in type_set_annotations()
964 PyErr_Format(PyExc_AttributeError, "__annotations__"); in type_set_annotations()
967 result = PyDict_DelItem(type->tp_dict, &_Py_ID(__annotations__)); in type_set_annotations()
1020 {"__annotations__", (gette
[all...]
/third_party/python/Lib/
H A Dreprlib.py31 wrapper.__annotations__ = getattr(user_function, '__annotations__', {})
H A Dtyping.py1888 _SPECIAL_NAMES = ['__abstractmethods__', '__annotations__', '__dict__', '__doc__',
1906 annotations = getattr(base, '__annotations__', {})
2072 annotations = getattr(base, '__annotations__', {})
2281 This is often the same as obj.__annotations__, but it handles
2319 ann = base.__dict__.get('__annotations__', {})
2353 hints = getattr(obj, '__annotations__', None)
2845 nm_tpl.__annotations__ = nm_tpl.__new__.__annotations__ = types
2854 _special = frozenset({'__module__', '__name__', '__annotations__'})
2865 types = ns.get('__annotations__', {})
[all...]
/third_party/python/Include/internal/
H A Dpycore_global_strings.h72 STRUCT_FOR_ID(__annotations__)
H A Dpycore_runtime_init.h695 INIT_ID(__annotations__), \
/third_party/python/Lib/unittest/test/testmock/
H A Dtestpatch.py1917 with patch.object(foo, '__annotations__', dict([('s', 1, )])):
1918 self.assertEqual(foo.__annotations__, dict([('s', 1, )]))
1919 self.assertEqual(foo.__annotations__, dict())
/third_party/python/Python/
H A Dceval.c3346 /* check if __annotations__ in locals()... */
3349 &_Py_ID(__annotations__));
3359 err = PyDict_SetItem(LOCALS(), &_Py_ID(__annotations__),
3369 ann_dict = PyObject_GetItem(LOCALS(), &_Py_ID(__annotations__));
3379 err = PyObject_SetItem(LOCALS(), &_Py_ID(__annotations__),
H A Dcompile.c2156 /* Every annotated class and module should have __annotations__. */ in compiler_body()
6123 ADDOP_NAME(c, LOAD_NAME, &_Py_ID(__annotations__), names); in compiler_annassign()

Completed in 66 milliseconds