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