예제 #1
0
 def test_parse_none(self):
   assert parse_instances(None) is None
   assert parse_instances("") is None
예제 #2
0
  def test_parse_instances_invalid_ranges(self):
    with pytest.raises(ArgumentTypeError):
      parse_instances("4-1")

    with pytest.raises(ArgumentTypeError):
      parse_instances("1-0")
예제 #3
0
 def test_parse_instances(self):
   instances = '0,1-3,5'
   x = parse_instances(instances)
   assert x == [0, 1, 2, 3, 5]
예제 #4
0
 def test_parse_instances_with_range(self):
   assert parse_instances("0-3") == [0, 1, 2, 3]
예제 #5
0
 def test_parse_instances_mixed(self):
   assert parse_instances("4,1-2,0-0") == [0, 1, 2, 4]
예제 #6
0
 def test_parse_none(self):
     assert parse_instances(None) is None
     assert parse_instances("") is None
예제 #7
0
 def test_parse_instances(self):
     instances = '0,1-3,5'
     x = parse_instances(instances)
     assert x == [0, 1, 2, 3, 5]
예제 #8
0
    def test_parse_instances_invalid_ranges(self):
        with pytest.raises(ArgumentTypeError):
            parse_instances("4-1")

        with pytest.raises(ArgumentTypeError):
            parse_instances("1-0")
예제 #9
0
 def test_parse_instances_mixed(self):
     assert parse_instances("4,1-2,0-0") == [0, 1, 2, 4]
예제 #10
0
 def test_parse_instances_with_range(self):
     assert parse_instances("0-3") == [0, 1, 2, 3]