Test Failed
Push — dev ( 0451e7...525e4d )
by Konstantinos
02:22
created

tests.test_parsing_track   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
A parsable_track_lines() 0 13 1
A test_parsing_track_line() 0 8 1
1
import pytest
2
3
4
@pytest.fixture(params=(
5
    ('01. track_name - 00:00', ('track_name', '00:00')),
6
    ('01,   1312 - 00:00:00', ('1312', '00:00:00')),
7
    ('2  -  Faith in Physics - 12:43', ('Faith in Physics', '12:43')),
8
    ('23   -   Ντίσκο Τσουτσούνι - 1:00:00', ('Ντίσκο Τσουτσούνι', '1:00:00')),
9
    ('2.  Man vs. God - 0:07', ('Man vs. God', '0:07')),
10
))
11
def parsable_track_lines(request):
12
    """A track line (str) that we can parse."""
13
    return {
14
        'track_line': request.param[0],
15
        'expected_track_name': request.param[1][0],
16
        'expected_parsed_time': request.param[1][1],
17
    }
18
19
20
def test_parsing_track_line(parsable_track_lines):
21
    """Test parsing a track line."""
22
    from typing import List
23
    from music_album_creation.tracks_parsing import StringParser
24
    parser = StringParser()
25
    track_name, parsed_time = parser._parse_track_line(parsable_track_lines['track_line'])
26
    assert track_name == parsable_track_lines['expected_track_name']
27
    assert parsed_time == parsable_track_lines['expected_parsed_time']
28