Ejemplo n.º 1
0
 def test_assignment_from_dict(self):
     self.test.address = to_python(self.ad1_dict)
     self.assertEqual(self.test.address.raw, self.ad1_dict['raw'])
     self.assertEqual(
         self.test.address.street_number, self.ad1_dict['street_number'])
     self.assertEqual(self.test.address.route, self.ad1_dict['route'])
     self.assertEqual(
         self.test.address.locality.name, self.ad1_dict['locality'])
     self.assertEqual(
         self.test.address.locality.postal_code,
         self.ad1_dict['postal_code']
     )
     self.assertEqual(
         self.test.address.locality.state.name,
         self.ad1_dict['state']
     )
     self.assertEqual(
         self.test.address.locality.state.code,
         self.ad1_dict['state_code']
     )
     self.assertEqual(
         self.test.address.locality.state.country.name,
         self.ad1_dict['country']
     )
     self.assertEqual(
         self.test.address.locality.state.country.code,
         self.ad1_dict['country_code']
     )
Ejemplo n.º 2
0
 def test_assignment_from_dict_no_state(self):
     ad = {
         'raw': 'Somewhere',
         'locality': 'Northcote',
         'country': 'Australia',
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad['raw'])
     self.assertEqual(self.test.address.street_number, '')
     self.assertEqual(self.test.address.route, '')
     self.assertEqual(self.test.address.locality, None)
Ejemplo n.º 3
0
 def test_assignment_from_dict_only_address(self):
     ad = {
         "raw": "1 Somewhere Street, Northcote, Victoria 3070, VIC, AU",
         "street_number": "1",
         "route": "Somewhere Street",
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad["raw"])
     self.assertEqual(self.test.address.street_number, ad["street_number"])
     self.assertEqual(self.test.address.route, ad["route"])
     self.assertEqual(self.test.address.locality, None)
Ejemplo n.º 4
0
 def test_assignment_from_dict_no_state(self):
     ad = {
         'raw': 'Somewhere',
         'locality': 'Northcote',
         'country': 'Australia',
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad['raw'])
     self.assertEqual(self.test.address.street_number, '')
     self.assertEqual(self.test.address.route, '')
     self.assertEqual(self.test.address.locality, None)
Ejemplo n.º 5
0
 def test_assignment_from_dict_no_state(self):
     ad = {
         "raw": "Somewhere",
         "locality": "Northcote",
         "country": "Australia",
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad["raw"])
     self.assertEqual(self.test.address.street_number, "")
     self.assertEqual(self.test.address.route, "")
     self.assertEqual(self.test.address.locality, None)
Ejemplo n.º 6
0
 def test_assignment_from_dict_only_address(self):
     ad = {
         'raw': '1 Somewhere Street, Northcote, Victoria 3070, VIC, AU',
         'street_number': '1',
         'route': 'Somewhere Street',
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad['raw'])
     self.assertEqual(self.test.address.street_number, ad['street_number'])
     self.assertEqual(self.test.address.route, ad['route'])
     self.assertEqual(self.test.address.locality, None)
Ejemplo n.º 7
0
 def test_assignment_from_dict_only_address(self):
     ad = {
         'raw': '1 Somewhere Street, Northcote, Victoria 3070, VIC, AU',
         'street_number': '1',
         'route': 'Somewhere Street',
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad['raw'])
     self.assertEqual(self.test.address.street_number, ad['street_number'])
     self.assertEqual(self.test.address.route, ad['route'])
     self.assertEqual(self.test.address.locality, None)
 def test_assignment_from_dict(self):
     self.test.address = to_python(self.ad1_dict)
     self.assertEqual(self.test.address.raw, self.ad1_dict['raw'])
     self.assertEqual(self.test.address.street_number, self.ad1_dict['street_number'])
     self.assertEqual(self.test.address.route, self.ad1_dict['route'])
     self.assertEqual(self.test.address.locality.name, self.ad1_dict['locality'])
     self.assertEqual(self.test.address.locality.postal_code, self.ad1_dict['postal_code'])
     self.assertEqual(self.test.address.locality.state.name, self.ad1_dict['state'])
     self.assertEqual(self.test.address.locality.state.code, self.ad1_dict['state_code'])
     self.assertEqual(self.test.address.locality.state.country.name, self.ad1_dict['country'])
     self.assertEqual(self.test.address.locality.state.country.code, self.ad1_dict['country_code'])
Ejemplo n.º 9
0
 def test_assignment_from_dict_no_locality(self):
     ad = {
         "raw": "1 Somewhere Street, Northcote, Victoria 3070, VIC, AU",
         "street_number": "1",
         "route": "Somewhere Street",
         "state": "Victoria",
         "country": "Australia",
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad["raw"])
     self.assertEqual(self.test.address.street_number, "")
     self.assertEqual(self.test.address.route, "")
     self.assertEqual(self.test.address.locality, None)
Ejemplo n.º 10
0
 def test_assignment_from_dict_no_locality(self):
     ad = {
         'raw': '1 Somewhere Street, Northcote, Victoria 3070, VIC, AU',
         'street_number': '1',
         'route': 'Somewhere Street',
         'state': 'Victoria',
         'country': 'Australia',
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad['raw'])
     self.assertEqual(self.test.address.street_number, '')
     self.assertEqual(self.test.address.route, '')
     self.assertEqual(self.test.address.locality, None)
Ejemplo n.º 11
0
 def test_assignment_from_dict_no_locality(self):
     ad = {
         'raw': '1 Somewhere Street, Northcote, Victoria 3070, VIC, AU',
         'street_number': '1',
         'route': 'Somewhere Street',
         'state': 'Victoria',
         'country': 'Australia',
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad['raw'])
     self.assertEqual(self.test.address.street_number, '')
     self.assertEqual(self.test.address.route, '')
     self.assertEqual(self.test.address.locality, None)
Ejemplo n.º 12
0
 def test_assignment_from_dict(self):
     self.test.address = to_python(self.ad1_dict)
     self.assertEqual(self.test.address.raw, self.ad1_dict["raw"])
     self.assertEqual(self.test.address.street_number,
                      self.ad1_dict["street_number"])
     self.assertEqual(self.test.address.route, self.ad1_dict["route"])
     self.assertEqual(self.test.address.locality.name,
                      self.ad1_dict["locality"])
     self.assertEqual(self.test.address.locality.postal_code,
                      self.ad1_dict["postal_code"])
     self.assertEqual(self.test.address.locality.state.name,
                      self.ad1_dict["state"])
     self.assertEqual(self.test.address.locality.state.code,
                      self.ad1_dict["state_code"])
     self.assertEqual(self.test.address.locality.state.country.name,
                      self.ad1_dict["country"])
     self.assertEqual(self.test.address.locality.state.country.code,
                      self.ad1_dict["country_code"])
 def test_assignment_from_dict_duplicate_state_code(self):
     ad = {
         'raw': '1 Somewhere Street, Northcote, Victoria 3070, VIC, AU',
         'street_number': '1',
         'route': 'Somewhere Street',
         'locality': 'Northcote',
         'state': 'Victoria',
         'state_code': 'Victoria',
         'country': 'Australia',
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad['raw'])
     self.assertEqual(self.test.address.street_number, '1')
     self.assertEqual(self.test.address.route, 'Somewhere Street')
     self.assertEqual(self.test.address.locality.name, 'Northcote')
     self.assertEqual(self.test.address.locality.state.name, 'Victoria')
     self.assertEqual(self.test.address.locality.state.code, 'Victoria')
     self.assertEqual(self.test.address.locality.state.country.name, 'Australia')
Ejemplo n.º 14
0
 def test_assignment_from_dict_duplicate_state_code(self):
     ad = {
         'raw': '1 Somewhere Street, Northcote, Victoria 3070, VIC, AU',
         'street_number': '1',
         'route': 'Somewhere Street',
         'locality': 'Northcote',
         'state': 'Victoria',
         'state_code': 'Victoria',
         'country': 'Australia',
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad['raw'])
     self.assertEqual(self.test.address.street_number, '1')
     self.assertEqual(self.test.address.route, 'Somewhere Street')
     self.assertEqual(self.test.address.locality.name, 'Northcote')
     self.assertEqual(self.test.address.locality.state.name, 'Victoria')
     self.assertEqual(self.test.address.locality.state.code, '')
     self.assertEqual(self.test.address.locality.state.country.name, 'Australia')
Ejemplo n.º 15
0
 def test_assignment_from_dict_duplicate_state_code(self):
     ad = {
         "raw": "1 Somewhere Street, Northcote, Victoria 3070, VIC, AU",
         "street_number": "1",
         "route": "Somewhere Street",
         "locality": "Northcote",
         "state": "Victoria",
         "state_code": "Victoria",
         "country": "Australia",
     }
     self.test.address = to_python(ad)
     self.assertEqual(self.test.address.raw, ad["raw"])
     self.assertEqual(self.test.address.street_number, "1")
     self.assertEqual(self.test.address.route, "Somewhere Street")
     self.assertEqual(self.test.address.locality.name, "Northcote")
     self.assertEqual(self.test.address.locality.state.name, "Victoria")
     self.assertEqual(self.test.address.locality.state.code, "Victoria")
     self.assertEqual(self.test.address.locality.state.country.name,
                      "Australia")
Ejemplo n.º 16
0
 def test_assignment_from_string(self):
     self.test.address = to_python(self.ad1_dict['raw'])
     self.assertEqual(self.test.address.raw, self.ad1_dict['raw'])
Ejemplo n.º 17
0
 def test_assignment_from_string(self):
     self.test.address = to_python(self.ad1_dict['raw'])
     self.assertEqual(self.test.address.raw, self.ad1_dict['raw'])