Passed
Push — master ( 00d837...bc5250 )
by Jace
49s
created

describe_font()   F

Complexity

Conditions 9

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 9
c 0
b 0
f 0
dl 0
loc 27
rs 3
1
# pylint: disable=unused-variable,expression-not-assigned,misplaced-comparison-constant,singleton-comparison
2
3
from pathlib import Path
4
5
import pytest
6
from expecter import expect
7
8
from memegen.domain import Font
9
10
11
def describe_font():
12
13
    @pytest.fixture
14
    def font():
15
        return Font(Path('mock_dir', 'FooBar.otf'))
16
17
    def describe_str():
18
19
        def is_based_on_name(font):
20
            expect(str(font)) == 'foobar'
21
22
    def describe_bool():
23
24
        def is_based_on_default(font):
25
            expect(bool(font)) == True
26
27
            font.DEFAULT = 'foobar'
28
            expect(bool(font)) == False
29
30
    def describe_name():
31
32
        def is_derived_from_filename(font):
33
            expect(font.name) == 'foobar'
34
35
        def it_replaces_underscores(font):
36
            font.path = Path('a_b')
37
            expect(font.name) == 'a-b'
38