def test_rendering(self): # Test subdivision-less rendering. address = Address(line1='BP 438', postal_code='75366', city_name='Paris CEDEX 08', country_code='FR') self.assertEquals( address.render(), textwrap.dedent("""\ BP 438 75366 - Paris CEDEX 08 France""")) # Test rendering of a state. address = Address(line1='1600 Amphitheatre Parkway', postal_code='94043', city_name='Mountain View', subdivision_code='US-CA') self.assertEquals( address.render(), textwrap.dedent("""\ 1600 Amphitheatre Parkway 94043 - Mountain View, California United States""")) # Test rendering of a city which is also its own state. address = Address(line1='Platz der Republik 1', postal_code='11011', city_name='Berlin', subdivision_code='DE-BE') self.assertEquals( address.render(), textwrap.dedent("""\ Platz der Republik 1 11011 - Berlin, Berlin Germany""")) # Test rendering of subdivision name as-is for extra precision. address = Address( line1='Dummy address', postal_code='F-12345', city_name='Dummy city', country_code='CP') # This is not an official country_code self.assertEquals( address.render(), textwrap.dedent("""\ Dummy address F-12345 - Dummy city Clipperton France""")) # Test deduplication of subdivision and country. address = Address(line1='Dummy address', postal_code='F-12345', city_name='Dummy city', country_code='RE', subdivision_code='FR-RE') self.assertEquals( address.render(), textwrap.dedent("""\ Dummy address F-12345 - Dummy city La Réunion Réunion""")) address = Address( line1='Dummy address', postal_code='F-12345', city_name='Dummy city', country_code='IC') # This is not an official country_code self.assertEquals( address.render(), textwrap.dedent("""\ Dummy address F-12345 - Dummy city Canarias Spain""")) address = Address(line1='Dummy address', postal_code='F-12345', city_name='Dummy city', subdivision_code='ES-CN') self.assertEquals( address.render(), textwrap.dedent("""\ Dummy address F-12345 - Dummy city Canarias Spain""")) # Test deduplication of subdivision and city. address = Address(line1='2 King Edward Street', postal_code='EC1A 1HQ', subdivision_code='GB-LND') self.assertEquals( address.render(), textwrap.dedent("""\ 2 King Edward Street EC1A 1HQ - London, City of United Kingdom"""))
def test_rendering(self): # Test subdivision-less rendering. address = Address( line1='BP 438', postal_code='75366', city_name='Paris CEDEX 08', country_code='FR') self.assertEquals(address.render(), textwrap.dedent("""\ BP 438 75366 - Paris CEDEX 08 France""")) # Test rendering of a state. address = Address( line1='1600 Amphitheatre Parkway', postal_code='94043', city_name='Mountain View', subdivision_code='US-CA') self.assertEquals(address.render(), textwrap.dedent("""\ 1600 Amphitheatre Parkway 94043 - Mountain View, California United States""")) # Test rendering of a city which is also its own state. address = Address( line1='Platz der Republik 1', postal_code='11011', city_name='Berlin', subdivision_code='DE-BE') self.assertEquals(address.render(), textwrap.dedent("""\ Platz der Republik 1 11011 - Berlin, Berlin Germany""")) # Test rendering of subdivision name as-is for extra precision. address = Address( line1='Dummy address', postal_code='F-12345', city_name='Dummy city', country_code='CP') self.assertEquals(address.render(), textwrap.dedent("""\ Dummy address F-12345 - Dummy city Clipperton France""")) # Test deduplication of subdivision and country. address = Address( line1='Dummy address', postal_code='F-12345', city_name='Dummy city', country_code='RE', subdivision_code='FR-RE') self.assertEquals(address.render(), textwrap.dedent("""\ Dummy address F-12345 - Dummy city Réunion""")) address = Address( line1='Dummy address', postal_code='F-12345', city_name='Dummy city', country_code='IC') self.assertEquals(address.render(), textwrap.dedent("""\ Dummy address F-12345 - Dummy city Canarias Spain""")) address = Address( line1='Dummy address', postal_code='F-12345', city_name='Dummy city', subdivision_code='ES-CN') self.assertEquals(address.render(), textwrap.dedent("""\ Dummy address F-12345 - Dummy city Canarias Spain""")) # Test deduplication of subdivision and city. address = Address( line1='2 King Edward Street', postal_code='EC1A 1HQ', subdivision_code='GB-LND') self.assertEquals(address.render(), textwrap.dedent("""\ 2 King Edward Street EC1A 1HQ - London, City of United Kingdom"""))
def test_rendering(self) -> None: # Test subdivision-less rendering. address = Address( line1="BP 438", postal_code="75366", city_name="Paris CEDEX 08", country_code="FR", ) assert address.render() == textwrap.dedent("""\ BP 438 75366 - Paris CEDEX 08 France""") # Test rendering of a state. address = Address( line1="1600 Amphitheatre Parkway", postal_code="94043", city_name="Mountain View", subdivision_code="US-CA", ) assert address.render() == textwrap.dedent("""\ 1600 Amphitheatre Parkway 94043 - Mountain View, California United States""") # Test rendering of a city which is also its own state. address = Address( line1="Platz der Republik 1", postal_code="11011", city_name="Berlin", subdivision_code="DE-BE", ) assert address.render() == textwrap.dedent("""\ Platz der Republik 1 11011 - Berlin Germany""") # Test rendering of subdivision name as-is for extra precision. address = Address( line1="Dummy address", postal_code="F-12345", city_name="Dummy city", country_code="CP", ) # This is not an official country_code assert address.render() == textwrap.dedent("""\ Dummy address F-12345 - Dummy city Clipperton France""") # Test deduplication of subdivision and country. address = Address( line1="Dummy address", postal_code="F-12345", city_name="Dummy city", country_code="RE", subdivision_code="FR-RE", ) assert address.render() == textwrap.dedent("""\ Dummy address F-12345 - Dummy city La Réunion Réunion""") address = Address( line1="Dummy address", postal_code="F-12345", city_name="Dummy city", country_code="IC", ) # This is not an official country_code assert address.render() == textwrap.dedent("""\ Dummy address F-12345 - Dummy city Canarias Spain""") address = Address( line1="Dummy address", postal_code="F-12345", city_name="Dummy city", subdivision_code="ES-CN", ) assert address.render() == textwrap.dedent("""\ Dummy address F-12345 - Dummy city Canarias Spain""") # Test deduplication of subdivision and city. address = Address( line1="2 King Edward Street", postal_code="EC1A 1HQ", subdivision_code="GB-LND", ) assert address.render() == textwrap.dedent("""\ 2 King Edward Street EC1A 1HQ - London, City of United Kingdom""")