File: test_path_parser.py

package info (click to toggle)
pyroon 0.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 372 kB
  • sloc: python: 1,660; sh: 135; makefile: 4
file content (66 lines) | stat: -rw-r--r-- 1,305 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# !/usr/bin/env python
# -*- coding: utf-8 -*-

from roonapi import split_media_path

"""Some tests of the path parser"""


def test_simple_paths():
    assert split_media_path("Library/Artists/Neil Young") == [
        "Library",
        "Artists",
        "Neil Young",
    ]

    assert split_media_path("Library/Artists/Neil Young/Harvest") == [
        "Library",
        "Artists",
        "Neil Young",
        "Harvest",
    ]

    assert split_media_path("My Live Radio/BBC Radio 4") == [
        "My Live Radio",
        "BBC Radio 4",
    ]

    assert split_media_path("Genres/Jazz/Cool") == [
        "Genres",
        "Jazz",
        "Cool",
    ]

    assert split_media_path("Genres/Rock/Pop") == [
        "Genres",
        "Rock",
        "Pop",
    ]


def test_edge_cases():
    assert split_media_path("") == []

    assert split_media_path("Library") == [
        "Library",
    ]

    assert split_media_path("/") == ["", ""]


def test_quoted_paths():
    assert split_media_path('"Library"/Artists/Neil Young') == [
        "Library",
        "Artists",
        "Neil Young",
    ]

    assert split_media_path('Genres/"Rock/Pop"') == [
        "Genres",
        "Rock/Pop",
    ]

    assert split_media_path('Genres/"Rock/Pop"') == [
        "Genres",
        "Rock/Pop",
    ]