예제 #1
0
 def test_getters_return_expected_data(self):
     instance = Location(self.__test_name, self.__test_lon, self.__test_lat,
                         self.__test_ID, self.__test_country)
     self.assertEqual(instance.get_name(), self.__test_name)
     self.assertEqual(instance.get_lon(), self.__test_lon)
     self.assertEqual(instance.get_lat(), self.__test_lat)
     self.assertEqual(instance.get_ID(), self.__test_ID)
     self.assertEqual(instance.get_country(), self.__test_country)
예제 #2
0
 def test_getters_return_expected_data(self):
     instance = Location(self.__test_name, self.__test_lon, self.__test_lat,
                         self.__test_ID, self.__test_country)
     self.assertEqual(instance.get_name(), self.__test_name)
     self.assertEqual(instance.get_lon(), self.__test_lon)
     self.assertEqual(instance.get_lat(), self.__test_lat)
     self.assertEqual(instance.get_ID(), self.__test_ID)
     self.assertEqual(instance.get_country(), self.__test_country)
예제 #3
0
 def test_location_for(self):
     expected = Location('Dongen', 4.938890, 51.626671, 2756723, 'NL')
     result = self._instance.location_for('dongen')
     self.assertEqual(result.get_name(), expected.get_name())
     self.assertEqual(result.get_country(), expected.get_country())
     self.assertEqual(result.get_ID(), expected.get_ID())
     self.assertEqual(result.get_lat(), expected.get_lat())
     self.assertEqual(result.get_lon(), expected.get_lon())
     self.assertTrue(self._instance.location_for('aaaaaaaaaa') is None)
예제 #4
0
 def test_location_for(self):
     ref_to_original = CityIDRegistry._get_lines
     CityIDRegistry._get_lines = self._mock_get_lines
     expected = Location('dongdu', 117.699997, 35.849998, 1812597, 'CN')
     result_1 = self._instance.location_for('dongdu')
     result_2 = self._instance.location_for('aaaaaaaaaa')
     CityIDRegistry._get_lines = ref_to_original        
     self.assertEqual(result_1.get_name(), expected.get_name())
     self.assertEqual(result_1.get_country(), expected.get_country())
     self.assertEqual(result_1.get_ID(), expected.get_ID())
     self.assertEqual(result_1.get_lat(), expected.get_lat())
     self.assertEqual(result_1.get_lon(), expected.get_lon())
     self.assertTrue(result_2 is None)
예제 #5
0
 def test_location_for(self):
     ref_to_original = CityIDRegistry._get_lines
     CityIDRegistry._get_lines = self._mock_get_lines
     expected = Location('dongdu', 117.699997, 35.849998, 1812597, 'CN')
     result_1 = self._instance.location_for('dongdu')
     result_2 = self._instance.location_for('aaaaaaaaaa')
     CityIDRegistry._get_lines = ref_to_original
     self.assertEqual(result_1.get_name(), expected.get_name())
     self.assertEqual(result_1.get_country(), expected.get_country())
     self.assertEqual(result_1.get_ID(), expected.get_ID())
     self.assertEqual(result_1.get_lat(), expected.get_lat())
     self.assertEqual(result_1.get_lon(), expected.get_lon())
     self.assertTrue(result_2 is None)