コード例 #1
0
 def test_decrement_right(self):
     ranges = [(1, 5)]
     remove_from_ranges(ranges, 5)
     self.assertEqual(ranges, [(1, 4)])
コード例 #2
0
 def test_dont_removing_unmatched_range(self):
     ranges = [(1, 3), (5, 7)]
     remove_from_ranges(ranges, 4)
     self.assertEqual(ranges, [(1, 3), (5, 7)])
コード例 #3
0
 def test_split_range_into_ranges(self):
     ranges = [(1, 7)]
     remove_from_ranges(ranges, 4)
     self.assertEqual(ranges, [(1, 3), (5, 7)])
コード例 #4
0
 def test_decrement_left(self):
     ranges = [(1, 5)]
     remove_from_ranges(ranges, 1)
     self.assertEqual(ranges, [(2, 5)])
コード例 #5
0
 def test_remove_unexistent(self):
     ranges = [1, 3]
     remove_from_ranges(ranges, 2)
     self.assertEqual(ranges, [1, 3])
コード例 #6
0
 def test_split_range(self):
     ranges = [(1, 5)]
     remove_from_ranges(ranges, 3)
     self.assertEqual(ranges, [1, 2, 4, 5])
コード例 #7
0
 def test_remove_inside(self):
     ranges = [1, 2, 3]
     remove_from_ranges(ranges, 2)
     self.assertEqual(ranges, [1, 3])
コード例 #8
0
 def test_remove_after(self):
     ranges = [1, 2]
     remove_from_ranges(ranges, 2)
     self.assertEqual(ranges, [1])
コード例 #9
0
 def test_remove_before(self):
     ranges = [1, 2]
     remove_from_ranges(ranges, 1)
     self.assertEqual(ranges, [2])
コード例 #10
0
 def test_single(self):
     ranges = [1]
     remove_from_ranges(ranges, 1)
     self.assertEqual(ranges, [])
コード例 #11
0
 def test_empty(self):
     ranges = []
     remove_from_ranges(ranges, 1)
     self.assertEqual(ranges, [])