with self.assertRaises(TypeError):
TypedDict(_typename='Emp', name=str, id=int)
- with self.assertRaises(TypeError):
- TypedDict('Emp', _fields={'name': str, 'id': int})
def test_typeddict_errors(self):
Emp = TypedDict('Emp', {'name': str, 'id': int})
isinstance(jim, Emp)
with self.assertRaises(TypeError):
issubclass(dict, Emp)
- with self.assertRaises(TypeError):
- TypedDict('Hi', x=1)
+ # We raise a DeprecationWarning for the keyword syntax
+ # before the TypeError.
+ with self.assertWarns(DeprecationWarning):
+ with self.assertRaises(TypeError):
+ TypedDict('Hi', x=1)
with self.assertRaises(TypeError):
TypedDict('Hi', [('x', int), ('y', 1)])
with self.assertRaises(TypeError):