Created
April 9, 2019 15:17
-
-
Save edgabaldi/f04981028bd2ed48750c68728360b5c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def almost_equal(self, checked, correct, significant_digits=1): | |
""" | |
Função Quase Igual | |
""" | |
precision = 0.1 ** significant_digits | |
return abs(checked - correct) < precision | |
class PolygonAlmostEqualTestCase(TestCase): | |
""" | |
Testa a função "quase igual" | |
""" | |
def setUp(self): | |
point = Point(lat=0, lon=0) | |
self.polygon = Polygon([point]) | |
def test_almost_equal(self): | |
self.assertTrue(self.polygon.almost_equal(0, 0)) | |
self.assertTrue(self.polygon.almost_equal(0, 0.09)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment