Ejemplo n.º 1
0
 def test_more_accurate_if_from_preferred_source(self):
     position1 = Position(lat=1.0, lon=1.0, source=1)
     position2 = Position(lat=1.0, lon=1.0, source=2)
     self.assertTrue(position1.more_accurate(position2))
Ejemplo n.º 2
0
 def test_not_more_accurate_if_not_found(self):
     position1 = Position(lat=1.0, lon=1.0)
     position2 = Position()
     self.assertFalse(position2.more_accurate(position1))
Ejemplo n.º 3
0
 def test_more_accurate_if_other_not_found(self):
     location1 = Position(lat=1.0, lon=1.0)
     location2 = Position()
     self.assertTrue(location1.more_accurate(location2))
Ejemplo n.º 4
0
 def test_does_not_agree_with_other_outside_accuracy(self):
     position1 = Position(lat=1.0, lon=1.0, accuracy=100)
     position2 = Position(lat=1.001, lon=1.001, accuracy=100)
     self.assertFalse(position1.agrees_with(position2))
Ejemplo n.º 5
0
 def test_never_accurate_enough(self):
     position = Position()
     self.assertFalse(position.accurate_enough())
Ejemplo n.º 6
0
 def test_not_found_when_lat_or_lon_is_None(self):
     for (lat, lon) in ((1.0, None), (None, 1.0), (None, None)):
         position = Position(lat=lat, lon=lon)
         self.assertFalse(position.found())
Ejemplo n.º 7
0
 def test_agrees_with_other_when_distance_within_accuracy(self):
     position1 = Position(lat=1.0, lon=1.0, accuracy=1000)
     position2 = Position(lat=1.001, lon=1.001, accuracy=1000)
     self.assertTrue(position1.agrees_with(position2))
Ejemplo n.º 8
0
 def test_more_accurate_if_from_preferred_source(self):
     position1 = Position(lat=1.0, lon=1.0, source=1)
     position2 = Position(lat=1.0, lon=1.0, source=2)
     self.assertTrue(position1.more_accurate(position2))
Ejemplo n.º 9
0
 def test_more_accurate_if_agrees_and_lower_accuracy(self):
     position1 = Position(lat=1.0, lon=1.0, accuracy=500)
     position2 = Position(lat=1.0, lon=1.0, accuracy=1000)
     self.assertTrue(position1.more_accurate(position2))
Ejemplo n.º 10
0
 def test_not_more_accurate_if_not_found(self):
     position1 = Position(lat=1.0, lon=1.0)
     position2 = Position()
     self.assertFalse(position2.more_accurate(position1))
Ejemplo n.º 11
0
 def test_more_accurate_if_other_not_found(self):
     location1 = Position(lat=1.0, lon=1.0)
     location2 = Position()
     self.assertTrue(location1.more_accurate(location2))
Ejemplo n.º 12
0
 def test_never_accurate_enough(self):
     position = Position()
     self.assertFalse(position.accurate_enough())
Ejemplo n.º 13
0
 def test_does_not_agree_with_other_outside_accuracy(self):
     position1 = Position(lat=1.0, lon=1.0, accuracy=100)
     position2 = Position(lat=1.001, lon=1.001, accuracy=100)
     self.assertFalse(position1.agrees_with(position2))
Ejemplo n.º 14
0
 def test_agrees_with_other_when_distance_within_accuracy(self):
     position1 = Position(lat=1.0, lon=1.0, accuracy=1000)
     position2 = Position(lat=1.001, lon=1.001, accuracy=1000)
     self.assertTrue(position1.agrees_with(position2))
Ejemplo n.º 15
0
 def test_more_accurate_if_agrees_and_lower_accuracy(self):
     position1 = Position(lat=1.0, lon=1.0, accuracy=500)
     position2 = Position(lat=1.0, lon=1.0, accuracy=1000)
     self.assertTrue(position1.more_accurate(position2))
Ejemplo n.º 16
0
 def test_not_found_when_lat_or_lon_is_None(self):
     for (lat, lon) in ((1.0, None), (None, 1.0), (None, None)):
         position = Position(lat=lat, lon=lon)
         self.assertFalse(position.found())
Ejemplo n.º 17
0
 def test_found_when_lat_lon_set(self):
     position = Position(lat=1.0, lon=1.0)
     self.assertTrue(position.found())
Ejemplo n.º 18
0
 def test_found_when_lat_lon_set(self):
     position = Position(lat=1.0, lon=1.0)
     self.assertTrue(position.found())