コード例 #1
0
 def test_in_range_inclusive(self):
     """
     Tests that on inclusive ranges, values that are in the range
     are valid.
     """
     instance = Range('@10:20')
     assert instance.in_range(15)
コード例 #2
0
 def test_in_range_inclusive_equal_to_end(self):
     """
     Tests that on inclusive ranges, values that are equal to
     the end are valid.
     """
     instance = Range('@10:20')
     assert instance.in_range(20)
コード例 #3
0
ファイル: test_range.py プロジェクト: beyonddevnull/pynagios
 def test_in_range_inclusive(self):
     """
     Tests that on inclusive ranges, values that are in the range
     are valid.
     """
     instance = Range('@10:20')
     assert instance.in_range(15)
コード例 #4
0
ファイル: test_range.py プロジェクト: beyonddevnull/pynagios
 def test_in_range_inclusive_equal_to_end(self):
     """
     Tests that on inclusive ranges, values that are equal to
     the end are valid.
     """
     instance = Range('@10:20')
     assert instance.in_range(20)
コード例 #5
0
ファイル: test_perf_data.py プロジェクト: xaque208/pynagios
 def test_valid_warn_range_as_range(self):
     """
     Tests to verify that warning range can be set to range object.
     """
     value = Range("10:20")
     instance = PerfData("foo", "7", warn=value)
     assert value == instance.warn
コード例 #6
0
 def test_range_with_only_beginning(self):
     """
     Tests ranges with only a beginning are parsed properly.
     """
     instance = Range('10:')
     assert 10.0 == instance.start
     assert float("inf") == instance.end
コード例 #7
0
 def test_range_with_end_smaller_than_start(self):
     """
     Tests that ranges which have an end larger than the start
     are invalid.
     """
     with pytest.raises(RangeValueError):
         Range('20:10')
コード例 #8
0
ファイル: test_perf_data.py プロジェクト: xaque208/pynagios
 def test_valid_crit_range_as_range(self):
     """
     Tests to verify that crit range can be set to range object.
     """
     value = Range("10:20")
     instance = PerfData("foo", "7", crit=value)
     assert value == instance.crit
コード例 #9
0
 def test_range_with_inclusive(self):
     """
     Tests that a range can be inclusive.
     """
     instance = Range('@10:20')
     assert 10.0 == instance.start
     assert 20.0 == instance.end
     assert instance.inclusive
コード例 #10
0
 def test_range_with_equal_start_and_small(self):
     """
     Tests that the start and end can be equal.
     """
     instance = Range('10:10')
     assert 10.0 == instance.start
     assert 10.0 == instance.end
     assert not instance.inclusive
コード例 #11
0
 def test_range_with_positive_inf(self):
     """
     Tests that positive infinity is a valid end.
     """
     instance = Range('10:~')
     assert 10.0 == instance.start
     assert float("inf") == instance.end
     assert not instance.inclusive
コード例 #12
0
 def test_range_as_string(self):
     """
     Tests that the range can be converted back to a valid string
     format.
     """
     tests = ["10", "10:20", "20", "~:10", "@10:15", "@~:~", "10:~"]
     for test in tests:
         assert test == str(Range(test))
コード例 #13
0
 def test_range_with_negative_inf(self):
     """
     Tests that negative infinity is valid for start.
     """
     instance = Range('~:20')
     assert float("-inf") == instance.start
     assert 20.0 == instance.end
     assert not instance.inclusive
コード例 #14
0
 def test_range_with_only_end(self):
     """
     Tests ranges with only an end value, such as '10'
     """
     instance = Range('10')
     assert 0.0 == instance.start
     assert 10.0 == instance.end
     assert not instance.inclusive
コード例 #15
0
 def test_range_with_both(self):
     """
     Tests ranges with a valid float for start and end and
     ensures they are valid.
     """
     instance = Range('10:20')
     assert 10.0 == instance.start
     assert 20.0 == instance.end
     assert not instance.inclusive
コード例 #16
0
 def test_range_with_empty_start(self):
     """
     Tests ranges with an empty start value.
     """
     with pytest.raises(RangeValueError):
         Range(':10')
コード例 #17
0
 def test_in_range_below_valid(self):
     """
     Tests that values outside the lower end of the range are valid.
     """
     instance = Range('10:20')
     assert instance.in_range(9)
コード例 #18
0
 def test_in_range_above_valid(self):
     """
     Tests that values outside the upper end of the range are valid.
     """
     instance = Range('10:20')
     assert instance.in_range(21)
コード例 #19
0
 def test_in_range_exclusive_equal_to_end_invalid(self):
     """
     Tests that exclusive ranges do not count the end value.
     """
     instance = Range('10:20')
     assert not instance.in_range(20)
コード例 #20
0
ファイル: test_range.py プロジェクト: beyonddevnull/pynagios
 def test_in_range_below_valid(self):
     """
     Tests that values outside the lower end of the range are valid.
     """
     instance = Range('10:20')
     assert instance.in_range(9)
コード例 #21
0
 def test_range_with_empty(self):
     """
     Tests empty ranges should throw an error.
     """
     with pytest.raises(RangeValueError):
         Range('')
コード例 #22
0
 def test_range_with_too_many_values(self):
     """
     Tests ranges with too many values throws an error.
     """
     with pytest.raises(RangeValueError):
         Range("10:20:30")
コード例 #23
0
ファイル: test_range.py プロジェクト: beyonddevnull/pynagios
 def test_in_range_exclusive_equal_to_end_invalid(self):
     """
     Tests that exclusive ranges do not count the end value.
     """
     instance = Range('10:20')
     assert not instance.in_range(20)
コード例 #24
0
 def test_range_with_bad_start(self):
     """
     Tests ranges with a bad start value are invalid.
     """
     with pytest.raises(RangeValueError):
         Range('bad:10')
コード例 #25
0
ファイル: test_range.py プロジェクト: beyonddevnull/pynagios
 def test_in_range_above_valid(self):
     """
     Tests that values outside the upper end of the range are valid.
     """
     instance = Range('10:20')
     assert instance.in_range(21)
コード例 #26
0
 def test_range_with_bad_end(self):
     """
     Tests ranges with a bad end value are invalid.
     """
     with pytest.raises(RangeValueError):
         Range('10:bad')