def test_dict_access(self): address = Address(line1='10, avenue des Champs Elysées', postal_code='75008', city_name='Paris', country_code='FR') self.assertSequenceEqual( set([ 'line1', 'line2', 'postal_code', 'city_name', 'country_code', 'subdivision_code', ]), set(address.keys())) self.assertEquals(len(address), 6) self.assertEquals( set([ None, '10, avenue des Champs Elysées', '75008', 'Paris', 'FR' ]), set(address.values())) self.assertEquals( { 'line1': '10, avenue des Champs Elysées', 'line2': None, 'postal_code': '75008', 'city_name': 'Paris', 'country_code': 'FR', 'subdivision_code': None, }, dict(address.items())) for key in address: self.assertEquals(getattr(address, key), address[key])
def test_dict_access(self): address = Address( line1='10, avenue des Champs Elysées', postal_code='75008', city_name='Paris', country_code='FR') self.assertSequenceEqual(set([ 'line1', 'line2', 'postal_code', 'city_name', 'country_code', 'subdivision_code', ]), set(address.keys())) self.assertEquals(len(address), 6) self.assertEquals( set([None, '10, avenue des Champs Elysées', '75008', 'Paris', 'FR']), set(address.values())) self.assertEquals({ 'line1': '10, avenue des Champs Elysées', 'line2': None, 'postal_code': '75008', 'city_name': 'Paris', 'country_code': 'FR', 'subdivision_code': None, }, dict(address.items())) for key in address: self.assertEquals(getattr(address, key), address[key])
def test_dict_access(self) -> None: address = Address( line1="10, avenue des Champs Elysées", postal_code="75008", city_name="Paris", country_code="FR", ) assert { "line1", "line2", "postal_code", "city_name", "country_code", "subdivision_code", } == set(address) assert len(address) == 6 assert {"10, avenue des Champs Elysées", "75008", "Paris", "FR", None} == set(address.values()) assert { "line1": "10, avenue des Champs Elysées", "line2": None, "postal_code": "75008", "city_name": "Paris", "country_code": "FR", "subdivision_code": None, } == dict(address.items()) for key in address: assert getattr(address, key) == address[key]