Exemplo n.º 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"
     )
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")