Ejemplo n.º 1
0
    def test_format_empty_interval(self):
        numbers = []
        formatted_interval = IntervalsFormatter.format(numbers)

        self.assertEqual("[]", formatted_interval)
Ejemplo n.º 2
0
 def test_given_interval_is_not_changed(self):
     original_numbers = [2, 1, 4, 3, 6, 5]
     numbers = [2, 1, 4, 3, 6, 5]
     IntervalsFormatter.format(numbers)
     self.assertEqual(original_numbers, numbers)
Ejemplo n.º 3
0
    def test_format_unsorted_interval(self):
        numbers = [2, 1, 4, 3, 6, 5]
        formatted_interval = IntervalsFormatter.format(numbers)

        self.assertEqual("[1-6]", formatted_interval)
Ejemplo n.º 4
0
    def test_format_interval_with_many_items(self):
        numbers = [1, 2, 3, 4, 5, 6]
        formatted_interval = IntervalsFormatter.format(numbers)

        self.assertEqual("[1-6]", formatted_interval)
Ejemplo n.º 5
0
    def test_format_interval_with_two_items(self):
        numbers = [1, 2]
        formatted_interval = IntervalsFormatter.format(numbers)

        self.assertEqual("[1-2]", formatted_interval)
Ejemplo n.º 6
0
    def test_format_interval_with_single_item(self):
        numbers = [1]
        formatted_interval = IntervalsFormatter.format(numbers)

        self.assertEqual("[1]", formatted_interval)