Esempio n. 1
0
 def test_fails_on_one_arg(self):
     with self.assertRaises(TypeError):
         j(1)
Esempio n. 2
0
 def test_fails_on_three_args(self):
     with self.assertRaises(TypeError):
         j(1, 2, 3)
Esempio n. 3
0
 def test_larger_lists(self):
     result = j(range(1, 10), [10, 9, 8, 7, 6])
     self.assertEqual(result, 2/5)
Esempio n. 4
0
 def test_fails_on_one_arg(self):
     with self.assertRaises(TypeError):
         j(1)
Esempio n. 5
0
 def test_half_for_double(self):
     result = j(['cow'], ['dog', 'cow'])
     self.assertEqual(result, 0.5)
Esempio n. 6
0
 def test_half_for_two_thirds_same(self):
     result = j([1, 2, 3], [2, 3, 4])
     self.assertEqual(result, 0.5)
Esempio n. 7
0
 def test_half_for_double(self):
     result = j(['cow'], ['dog', 'cow'])
     self.assertEqual(result, 0.5)
Esempio n. 8
0
 def test_order_not_important(self):
     result = j([3, 2, 1], [1, 3, 2])
     self.assertEqual(result, 1)
Esempio n. 9
0
 def test_order_not_important(self):
     result = j([3, 2, 1], [1, 3, 2])
     self.assertEqual(result, 1)
Esempio n. 10
0
 def test_zero_for_different(self):
     result = j([1, 2, 3], [4, 5, 6])
     self.assertEqual(result, 0)
Esempio n. 11
0
 def test_result_is_float(self):
     result = j([1, 2, 3], [1, 2, 3])
     self.assertIs(type(result), type(1.0))
Esempio n. 12
0
 def test_one_for_same(self):
     result = j([1, 2, 3], [1, 2, 3])
     self.assertEqual(result, 1)
Esempio n. 13
0
 def test_fails_on_three_args(self):
     with self.assertRaises(TypeError):
         j(1, 2, 3)
Esempio n. 14
0
 def test_one_for_same(self):
     result = j([1, 2, 3], [1, 2, 3])
     self.assertEqual(result, 1)
Esempio n. 15
0
 def test_third_for_half_same(self):
     result = j([1, 2], [2, 3])
     self.assertEqual(result, 1/3)
Esempio n. 16
0
 def test_result_is_float(self):
     result = j([1, 2, 3], [1, 2, 3])
     self.assertIs(type(result), type(1.0))
Esempio n. 17
0
 def test_half_for_two_thirds_same(self):
     result = j([1, 2, 3], [2, 3, 4])
     self.assertEqual(result, 0.5)
Esempio n. 18
0
 def test_zero_for_different(self):
     result = j([1, 2, 3], [4, 5, 6])
     self.assertEqual(result, 0)
Esempio n. 19
0
 def test_immune_to_duplicates(self):
     result = j([1, 1, 2], [3, 3, 3, 2, 2])
     self.assertEqual(result, 1/3)
Esempio n. 20
0
 def test_third_for_half_same(self):
     result = j([1, 2], [2, 3])
     self.assertEqual(result, 1/3)
Esempio n. 21
0
 def test_larger_lists(self):
     result = j(range(1, 10), [10, 9, 8, 7, 6])
     self.assertEqual(result, 2/5)
Esempio n. 22
0
 def test_immune_to_duplicates(self):
     result = j([1, 1, 2], [3, 3, 3, 2, 2])
     self.assertEqual(result, 1/3)
Esempio n. 23
0
 def test_by_defn_two_empty_lists_have_similarity_one(self):
     result = j([], [])
     self.assertEqual(result, 1.0)
Esempio n. 24
0
 def test_fails_on_no_args(self):
     with self.assertRaises(TypeError):
         j()
Esempio n. 25
0
 def test_fails_on_no_args(self):
     with self.assertRaises(TypeError):
         j()