def test_data(self): self.assertListEqual([ CountryData(1, "US", "United States", True), CountryData(14, "AU", "Australia", True), CountryData(15, "AT", "Austria", True), CountryData(2, "CA", "Canada", True), CountryData(4, "DE", "Germany", True), CountryData(89, "IE", "Ireland", True), CountryData(117, "MT", "Malta", True), CountryData(132, "NL", "Netherlands", True), CountryData(3, "GB", "United Kingdom", True) ], self.data)
def object_hook(self, dct): if "countries" in dct: return [ CountryData(data["countryId"], data["countryCode"], data["name"], data["isLicensed"]) for data in dct["countries"] ] return dct
def test_asdict(self): self.assertEqual( { "id": 1, "code": "some code", "name": "some name", "licensed": True }, CountryData(1, "some code", "some name", True).asdict())
def test_not_equal_when_not_same_class_and_not_same_values(self): self.assertNotEqual( CountryData(1, "2", "3", True), MagicMock(country_id=2, code="2", name="3", licensed=True))
def test_not_equal_when_same_class_but_not_same_values(self): self.assertNotEqual(CountryData(1, "2", "3", True), CountryData(2, "2", "3", True))
def test_equal_when_same_class_and_same_exact_values(self): self.assertEqual(CountryData(1, "2", "3", True), CountryData(1, "2", "3", True))