Beispiel #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))
Beispiel #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))
Beispiel #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))
Beispiel #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))
Beispiel #5
0
 def test_never_accurate_enough(self):
     position = Position()
     self.assertFalse(position.accurate_enough())
Beispiel #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())
Beispiel #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))
Beispiel #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))
Beispiel #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))
Beispiel #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))
Beispiel #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))
Beispiel #12
0
 def test_never_accurate_enough(self):
     position = Position()
     self.assertFalse(position.accurate_enough())
Beispiel #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))
Beispiel #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))
Beispiel #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))
Beispiel #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())
Beispiel #17
0
 def test_found_when_lat_lon_set(self):
     position = Position(lat=1.0, lon=1.0)
     self.assertTrue(position.found())
Beispiel #18
0
 def test_found_when_lat_lon_set(self):
     position = Position(lat=1.0, lon=1.0)
     self.assertTrue(position.found())