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
def test_can_compare_to_normal_dict_with_namespace(): stats = Stats().namespaced('level1') stats.increment('abc') assert stats == {'abc': 1} assert stats != {}
def test_can_compare_to_normal_dict(): stats = Stats() stats.increment('abc') assert stats == {'abc': 1} assert stats != {}
def test_increment(): stats = Stats() stats.increment('mycounter') assert stats.get('mycounter', 1) stats.increment('mycounter') assert stats.get('mycounter', 2)
def test_injects_stats(): stats = Stats() stats.increment('counter') Assertion(stats, [stats_assertion]).run()