def test_equality(self) -> None: x = StrIntMap({"foo": 5, "bar": 4}) y = StrIntMap({"foo": 4, "bar": 5}) self.assertNotEqual(x, y) y = StrIntMap({"foo": 5, "bar": 4}) self.assertEqual(x, y) self.assertEqual(x, x) self.assertEqual(y, y)
def test_equality(self) -> None: x = StrIntMap({'foo': 5, 'bar': 4}) y = StrIntMap({'foo': 4, 'bar': 5}) self.assertNotEqual(x, y) y = StrIntMap({'foo': 5, 'bar': 4}) self.assertEqual(x, y) self.assertEqual(x, x) self.assertEqual(y, y)
def test_None(self) -> None: with self.assertRaises(TypeError): StrIntMap({None: 5}) # type: ignore with self.assertRaises(TypeError): StrIntMap({"foo": None}) # type: ignore with self.assertRaises(TypeError): StrStrIntListMapMap({"bar": {"foo": [None, None]}}) # type: ignore with self.assertRaises(TypeError): StrStrIntListMapMap({"bar": {"foo": None}}) # type: ignore
def test_None(self): with self.assertRaises(TypeError): StrIntMap({None: 5}) with self.assertRaises(TypeError): StrIntMap({'foo': None}) with self.assertRaises(TypeError): StrStrIntListMapMap({'bar': {'foo': [None, None]}}) with self.assertRaises(TypeError): StrStrIntListMapMap({'bar': {'foo': None}})
def test_None(self) -> None: with self.assertRaises(TypeError): # pyre-fixme[6]: Expected `Optional[typing.Mapping[str, int]]` for 1st # param but got `Dict[None, int]`. StrIntMap({None: 5}) with self.assertRaises(TypeError): # pyre-fixme[6]: Expected `Optional[typing.Mapping[str, int]]` for 1st # param but got `Dict[str, None]`. StrIntMap({"foo": None}) with self.assertRaises(TypeError): # pyre-fixme[6]: Expected `Optional[typing.Mapping[str, # typing.Mapping[str, typing.Sequence[int]]]]` for 1st param but got # `Dict[str, Dict[str, List[None]]]`. StrStrIntListMapMap({"bar": {"foo": [None, None]}}) with self.assertRaises(TypeError): # pyre-fixme[6]: Expected `Optional[typing.Mapping[str, # typing.Mapping[str, typing.Sequence[int]]]]` for 1st param but got # `Dict[str, Dict[str, None]]`. StrStrIntListMapMap({"bar": {"foo": None}})
def test_empty(self) -> None: StrIntMap() StrIntMap({}) StrStrIntListMapMap({}) StrStrIntListMapMap({"foo": {}}) StrStrIntListMapMap({"foo": {"bar": []}})
def test_is_container(self) -> None: self.assertIsInstance(LocationMap, Container) self.assertIsInstance(StrI32ListMap(), Container) self.assertIsInstance(StrIntMap(), Container) self.assertIsInstance(StrStrIntListMapMap(), Container) self.assertIsInstance(StrStrMap(), Container)
def test_empty(self) -> None: StrIntMap() StrIntMap({}) StrStrIntListMapMap({}) StrStrIntListMapMap({'foo': {}}) StrStrIntListMapMap({'foo': {'bar': []}})