MCPcopy Index your code
hub / github.com/prometheus/client_python / test_gauge

Method test_gauge

tests/test_core.py:172–179  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

170 self.assertEqual(repr(self.gauge), "prometheus_client.metrics.Gauge(g)")
171
172 def test_gauge(self):
173 self.assertEqual(0, self.registry.get_sample_value('g'))
174 self.gauge.inc()
175 self.assertEqual(1, self.registry.get_sample_value('g'))
176 self.gauge.dec(3)
177 self.assertEqual(-2, self.registry.get_sample_value('g'))
178 self.gauge.set(9)
179 self.assertEqual(9, self.registry.get_sample_value('g'))
180
181 def test_inc_not_observable(self):
182 """.inc() must fail if the gauge is not observable."""

Callers

nothing calls this directly

Calls 4

get_sample_valueMethod · 0.80
decMethod · 0.80
incMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected