Пример #1
0
 def test_parse_line_with_underscores(self):
     """
     Tests that this line can properly pass. This was found to
     fail at some point in production.
     """
     p.parse_line(
         "hosts.lucid64.bi.metrics.tasks.update_session_create_counts:6.330013|ms"
     )
Пример #2
0
 def test_fails_no_type(self):
     """Tests that parsing fails for lines with no
     metric type."""
     with pytest.raises(ValueError):
         p.parse_line("k:27")
Пример #3
0
 def test_fails_no_value(self):
     """Tests that parsing fails for lines with no
     value (or key, depending on how you look at it)"""
     with pytest.raises(ValueError):
         p.parse_line("k|kv")
Пример #4
0
 def test_parses_float_flag(self):
     """Tests that float flags can be parsed."""
     assert ("k", 3, "ms", 0.1) == p.parse_line("k:3|ms|@0.1")
Пример #5
0
 def test_parses_float_value(self):
     """Tests that float values can be parsed."""
     assert ("k", 3.14, "ms", None) == p.parse_line("k:3.14|ms")
Пример #6
0
 def test_parses_negative_value(self):
     """Tests that lines can contain negative numbers as values."""
     assert ("k", -27, "ms", None) == p.parse_line("k:-27|ms")
Пример #7
0
 def test_parses_flag(self):
     """Tests that lines with flags (@ parameters) can be parsed
     properly."""
     assert ("k", 27, "ms", 123456) == p.parse_line("k:27|ms|@123456")
Пример #8
0
 def test_parses_negative_value(self):
     """Tests that lines can contain negative numbers as values."""
     assert ("k", -27, "ms", None) == p.parse_line("k:-27|ms")
Пример #9
0
 def test_parse_line_basic(self):
     """Tests the basic line type of: k:v|type"""
     assert ("k", 27, "kv", None) == p.parse_line("k:27|kv")
Пример #10
0
 def test_parse_line_with_underscores(self):
     """
     Tests that this line can properly pass. This was found to
     fail at some point in production.
     """
     p.parse_line("hosts.lucid64.bi.metrics.tasks.update_session_create_counts:6.330013|ms")
Пример #11
0
 def test_fails_negative_flag(self):
     """Tests that negative flags can not be parsed."""
     with pytest.raises(ValueError):
         p.parse_line("k:27|ms|@-24")
Пример #12
0
 def test_fails_no_type(self):
     """Tests that parsing fails for lines with no
     metric type."""
     with pytest.raises(ValueError):
         p.parse_line("k:27")
Пример #13
0
 def test_fails_no_value(self):
     """Tests that parsing fails for lines with no
     value (or key, depending on how you look at it)"""
     with pytest.raises(ValueError):
         p.parse_line("k|kv")
Пример #14
0
 def test_parses_float_flag(self):
     """Tests that float flags can be parsed."""
     assert ("k", 3, "ms", 0.1) == p.parse_line("k:3|ms|@0.1")
Пример #15
0
 def test_parses_float_value(self):
     """Tests that float values can be parsed."""
     assert ("k", 3.14, "ms", None) == p.parse_line("k:3.14|ms")
Пример #16
0
 def test_fails_negative_flag(self):
     """Tests that negative flags can not be parsed."""
     with pytest.raises(ValueError):
         p.parse_line("k:27|ms|@-24")
Пример #17
0
 def test_parse_line_basic(self):
     """Tests the basic line type of: k:v|type"""
     assert ("k", 27, "kv", None) == p.parse_line("k:27|kv")
Пример #18
0
 def test_parses_flag(self):
     """Tests that lines with flags (@ parameters) can be parsed
     properly."""
     assert ("k", 27, "ms", 123456) == p.parse_line("k:27|ms|@123456")