| Conditions | 8 |
| Total Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | # pylint: disable=missing-docstring,unused-variable,unused-argument,expression-not-assigned,singleton-comparison |
||
| 9 | def describe_cache(): |
||
| 10 | |||
| 11 | # pylint: disable=protected-access |
||
| 12 | |||
| 13 | @pytest.fixture |
||
| 14 | def cache(): |
||
| 15 | return Cache() |
||
| 16 | |||
| 17 | def describe_load(): |
||
| 18 | |||
| 19 | def it_loads_previous_results(cache): |
||
| 20 | cache._data['value'] = "saved" |
||
| 21 | cache._store() |
||
| 22 | |||
| 23 | expect(Cache.load()._data['value']) == "saved" |
||
| 24 | |||
| 25 | def describe_match(): |
||
| 26 | |||
| 27 | def it_hits_with_existing_data(cache): |
||
| 28 | cache._data['abc'] = 123 |
||
| 29 | |||
| 30 | expect(cache.match('abc', 123)) == True |
||
| 31 | |||
| 32 | def it_misses_with_no_data(cache): |
||
| 33 | cache._data.pop('abc', None) |
||
| 34 | |||
| 35 | expect(cache.match('abc', 123)) == False |
||
| 36 | |||
| 37 | def it_caches_requests(cache): |
||
| 38 | cache._data.pop('abc', None) |
||
| 39 | cache.match('abc', 123) |
||
| 40 | |||
| 41 | expect(cache.match('abc', 123)) == True |
||
| 42 |