Completed
Pull Request — develop (#18)
by Jace
06:37
created

describe_match()   A

Complexity

Conditions 4

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
dl 0
loc 17
rs 9.2
1
# pylint: disable=missing-docstring,unused-variable,unused-argument,expression-not-assigned,singleton-comparison
0 ignored issues
show
introduced by
Bad option value 'singleton-comparison'
Loading history...
2
3
import pytest
0 ignored issues
show
Configuration introduced by
The import pytest could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
4
from expecter import expect
0 ignored issues
show
Configuration introduced by
The import expecter could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
5
6
from coveragespace.cache import Cache
7
8
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