(self)
| 63 | self.assertRaises(ValueError, self.counter.inc, -1) |
| 64 | |
| 65 | def test_function_decorator(self): |
| 66 | @self.counter.count_exceptions(ValueError) |
| 67 | def f(r): |
| 68 | if r: |
| 69 | raise ValueError |
| 70 | else: |
| 71 | raise TypeError |
| 72 | |
| 73 | self.assertEqual((["r"], None, None, None), getargspec(f)) |
| 74 | |
| 75 | try: |
| 76 | f(False) |
| 77 | except TypeError: |
| 78 | pass |
| 79 | self.assertEqual(0, self.registry.get_sample_value('c_total')) |
| 80 | |
| 81 | try: |
| 82 | f(True) |
| 83 | except ValueError: |
| 84 | pass |
| 85 | self.assertEqual(1, self.registry.get_sample_value('c_total')) |
| 86 | |
| 87 | def test_block_decorator(self): |
| 88 | with self.counter.count_exceptions(): |
nothing calls this directly
no test coverage detected