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))
def test_found_when_lat_lon_set(self): position = Position(lat=1.0, lon=1.0) self.assertTrue(position.found())
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))
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))
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))
def test_never_accurate_enough(self): position = Position() self.assertFalse(position.accurate_enough())
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))
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))
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())