diff --git a/test/test_content/songsection.control b/test/test_content/songsection.control new file mode 100644 index 00000000..69dd034b --- /dev/null +++ b/test/test_content/songsection.control @@ -0,0 +1 @@ +["songsection:Traditional", "exsong.sg", "songchapter:English", "texsong.tsg", "chordpro.csg", "exsong.sg"] \ No newline at end of file diff --git a/test/test_content/songsection.source b/test/test_content/songsection.source new file mode 100644 index 00000000..089322c4 --- /dev/null +++ b/test/test_content/songsection.source @@ -0,0 +1,6 @@ +[["songsection", "Traditional"], + "exsong.sg", + ["songchapter", "English"], + "texsong.tsg", + "chordpro.csg", + "exsong.sg"] \ No newline at end of file diff --git a/test/test_content/test_content.py b/test/test_content/test_content.py index 8b279793..ec164a52 100644 --- a/test/test_content/test_content.py +++ b/test/test_content/test_content.py @@ -9,8 +9,7 @@ import json from patacrep.songs import DataSubpath, DEFAULT_CONFIG from patacrep import content, files -from patacrep.content.song import SongRenderer -from patacrep.content.section import Section +from patacrep.content import song, section, songsection from .. import dynamic # pylint: disable=unused-import @@ -71,14 +70,19 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): @classmethod def _clean_path(cls, elem): """Shorten the path relative to the `songs` directory""" - if isinstance(elem, SongRenderer): + if isinstance(elem, song.SongRenderer): songpath = os.path.join(os.path.dirname(__file__), 'datadir', 'songs') return files.path2posix(files.relpath(elem.song.fullpath, songpath)) - elif isinstance(elem, Section): + + elif isinstance(elem, section.Section): if elem.short is None: return "{}:{}".format(elem.keyword, elem.name) else: return "{}:({}){}".format(elem.keyword, elem.short, elem.name) + + elif isinstance(elem, songsection.SongSection): + return "{}:{}".format(elem.keyword, elem.name) + else: raise Exception(elem)