summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Socol <james@bit.ly>2013-08-26 18:10:48 -0400
committerJames Socol <james@bit.ly>2013-08-26 18:33:58 -0400
commit6d470fdebc3abdacdc1b2c0ccc150968c8082702 (patch)
treeb4cb04fcaa0a530dd9deb429dd27c10f287ac2e2
parent213fae888080f7cc39f1b20ac0962bd6fd12189b (diff)
downloadpystatsd-6d470fdebc3abdacdc1b2c0ccc150968c8082702.tar.gz
Update gauge delta tests.
-rw-r--r--statsd/tests.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/statsd/tests.py b/statsd/tests.py
index 00aeffe..75bee3d 100644
--- a/statsd/tests.py
+++ b/statsd/tests.py
@@ -132,18 +132,20 @@ def test_gauge():
def test_gauge_delta():
- sc = _client()
- sc.gauge('foo', 12, delta=True)
- _sock_check(sc, 1, 'foo:+12|g')
-
- sc.gauge('foo', -13, delta=True)
- _sock_check(sc, 2, 'foo:-13|g')
+ tests = (
+ (12, '+12'),
+ (-13, '-13'),
+ (1.2, '+1.2'),
+ (-1.3, '-1.3'),
+ )
- sc.gauge('foo', 1.2, delta=True)
- _sock_check(sc, 3, 'foo:+1.2|g')
+ def _check(num, result):
+ sc = _client()
+ sc.gauge('foo', num, delta=True)
+ _sock_check(sc, 1, 'foo:%s|g' % result)
- sc.gauge('foo', -1.3, delta=True)
- _sock_check(sc, 4, 'foo:-1.3|g')
+ for num, result in tests:
+ yield _check, num, result
@mock.patch.object(random, 'random', lambda: -1)