def test_sort_fractions_with_multiple_simplified_fractions(self): list_of_fractions = [Fraction(2, 3), Fraction(1, 2), Fraction(1, 3)] expected_list = [Fraction(1, 3), Fraction(1, 2), Fraction(2, 3)] res = sort_fractions(list_of_fractions) self.assertEqual(res[0], expected_list[0]) self.assertEqual(res[1], expected_list[1]) self.assertEqual(res[2], expected_list[2])
def test_sort_of_fractions(self): arr = [(5, 6), (22, 78), (22, 7), (7, 8), (9, 6), (15, 32)] expected_result = [(22, 78), (15, 32), (5, 6), (7, 8), (9, 6), (22, 7)] self.assertEqual(sort_fractions(arr), expected_result)
def test_sort_fractions_with_more_fractions(self): input_fractions = [(5, 6), (22, 78), (22, 7), (7, 8), (9, 6), (15, 32)] expected_result = [(22, 78), (15, 32), (5, 6), (7, 8), (9, 6), (22, 7)] self.assertEqual(frac.sort_fractions(input_fractions), expected_result)
def test_sort_fractions_with_three_fractions(self): input_fractions = ([(2, 3), (1, 2), (1, 3)]) expected_result = [(1, 3), (1, 2), (2, 3)] self.assertEqual(frac.sort_fractions(input_fractions), expected_result)
def test_sort_fractions(self): result = sort_fractions( [(5, 6), (22, 78), (22, 7), (7, 8), (9, 6), (15, 32)]) self.assertEqual( [(22, 78), (15, 32), (5, 6), (7, 8), (9, 6), (22, 7)], result)