Skip to content

Commit

Permalink
added test for distance(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bender committed Jul 24, 2018
1 parent 19c2596 commit 4abf64c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/test_ml.py
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ def test_nearest_neighbor(self):
self.assertEqual(nearest_neighbor((31, 242, 164), self.trainSetLight), 'L')
self.assertEqual(nearest_neighbor((13, 94, 64), self.trainSetLight), 'D')
self.assertEqual(nearest_neighbor((230, 52, 239), self.trainSetLight), 'L')

def test_distance(self):
self.assertAlmostEqual(distance((1,2,3), (1,0,-1)), 4.47, 2)
if __name__ == "__main__":
unittest.main()

0 comments on commit 4abf64c

Please sign in to comment.