Пример #1
0
 def test_add_frac(self):
     self.assertIs(fracs.cmp_frac(fracs.add_frac([1, 1], [1, 1]), [2, 1]),
                   0)
     self.assertIs(fracs.cmp_frac(fracs.add_frac([1, 2], [1, -2]), [0, 1]),
                   0)
     self.assertIs(fracs.cmp_frac(fracs.add_frac([1, 2], [1, 3]), [5, 6]),
                   0)
Пример #2
0
 def test_add_frac(self):
     self.assertEqual(fracs.add_frac([1, 2], [1, 3]), [5, 6])
     self.assertEqual(fracs.add_frac([-1, 2], [1, 3]), [-1, 6])
Пример #3
0
 def test_add_frac(self):
     self.assertEqual(fracs.add_frac(f1, f2), [-1, 2])
     self.assertEqual(fracs.add_frac(f2, f3), [3, 1])
     self.assertEqual(fracs.add_frac(f3, f4), [12, 2])
Пример #4
0
 def test_add_frac(self):
     self.assertEqual(fracs.add_frac(self.pierwszy, self.drugi), [8, 3])
Пример #5
0
 def test_add_frac(self):
     self.assertEqual(fracs.add_frac([1, 2], [1, 3]), [5, 6])
     self.assertEqual(fracs.add_frac([0, 2], [1, 3]), [1, 3])
     self.assertEqual(fracs.add_frac([-1, 2], [1, 2]), [0, 0])
     self.assertEqual(fracs.add_frac([1, 3], [1, 3]), [2, 3])
     self.assertEqual(fracs.add_frac([49, 100], [51, 100]), [1, 1])
Пример #6
0
 def test_add_frac(self):
     self.assertEqual(fracs.add_frac([1, 3], [1, 4]), [7, 12])
     self.assertEqual(fracs.add_frac([2, 2], [1, 2]), [3, 2])
     self.assertEqual(fracs.add_frac([5, 2], [1, 2]), [6, 2])