Example #1
0
def test_responds_to_dict_methods():
    stats = Stats()
    stats.increment('mycounter')

    assert list(stats.keys()) == ['mycounter']
    assert list(stats.values()) == [1]
    assert stats['mycounter'] == 1
Example #2
0
def test_can_compare_to_normal_dict_with_namespace():
    stats = Stats().namespaced('level1')
    stats.increment('abc')

    assert stats == {'abc': 1}
    assert stats != {}
Example #3
0
def test_can_compare_to_normal_dict():
    stats = Stats()
    stats.increment('abc')

    assert stats == {'abc': 1}
    assert stats != {}
Example #4
0
def test_increment():
    stats = Stats()
    stats.increment('mycounter')
    assert stats.get('mycounter', 1)
    stats.increment('mycounter')
    assert stats.get('mycounter', 2)
Example #5
0
def test_injects_stats():
    stats = Stats()
    stats.increment('counter')
    Assertion(stats, [stats_assertion]).run()