(self)
| 190 | self.assertEqualMetrics([metric_family], list(families)) |
| 191 | |
| 192 | def test_commas(self): |
| 193 | families = text_string_to_metric_families("""# TYPE a counter |
| 194 | # HELP a help |
| 195 | a{foo="bar",} 1 |
| 196 | a{foo="baz", } 1 |
| 197 | # TYPE b counter |
| 198 | # HELP b help |
| 199 | b{,} 2 |
| 200 | # TYPE c counter |
| 201 | # HELP c help |
| 202 | c{ ,} 3 |
| 203 | # TYPE d counter |
| 204 | # HELP d help |
| 205 | d{, } 4 |
| 206 | """) |
| 207 | a = CounterMetricFamily("a", "help", labels=["foo"]) |
| 208 | a.add_metric(["bar"], 1) |
| 209 | a.add_metric(["baz"], 1) |
| 210 | b = CounterMetricFamily("b", "help", value=2) |
| 211 | c = CounterMetricFamily("c", "help", value=3) |
| 212 | d = CounterMetricFamily("d", "help", value=4) |
| 213 | self.assertEqualMetrics([a, b, c, d], list(families)) |
| 214 | |
| 215 | def test_multiple_trailing_commas(self): |
| 216 | text = """# TYPE a counter |
nothing calls this directly
no test coverage detected