From 5b40ffbfd191ccb4bbcc67032869873b9761c2da Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Wed, 13 Jan 2016 09:31:35 +0100 Subject: [PATCH] Improve section testing --- test/test_content/sections.control | 12 +++++++++++- test/test_content/sections.source | 22 ++++++++++++++++------ test/test_content/sections_short.control | 1 - test/test_content/sections_short.source | 8 -------- test/test_content/test_content.py | 5 +---- 5 files changed, 28 insertions(+), 20 deletions(-) delete mode 100644 test/test_content/sections_short.control delete mode 100644 test/test_content/sections_short.source diff --git a/test/test_content/sections.control b/test/test_content/sections.control index 3666bbce..1aba242d 100644 --- a/test/test_content/sections.control +++ b/test/test_content/sections.control @@ -1 +1,11 @@ -["section:Traditional", "exsong.sg", "section:Example", "texsong.tsg", "chordpro.csg", "exsong.sg"] \ No newline at end of file +- "section{First Section!}" +- "section{Named section}" +- "section[section_short_name]{Section with short name}" +- "section*{Section* with short name}" +- "part{part section test}" +- "chapter{chapter section test}" +- "section{section section test}" +- "subsection{subsection section test}" +- "subsubsection{subsubsection section test}" +- "paragraph{paragraph section test}" +- "subparagraph{subparagraph section test}" \ No newline at end of file diff --git a/test/test_content/sections.source b/test/test_content/sections.source index 26ca63dc..ff5bae23 100644 --- a/test/test_content/sections.source +++ b/test/test_content/sections.source @@ -1,6 +1,16 @@ -- section: Traditional -- "exsong.sg" -- section: Example -- "texsong.tsg" -- "chordpro.csg" -- "exsong.sg" \ No newline at end of file +- section: First Section! +- section: + name: Named section +- section: + name: Section with short name + short: section_short_name +- section*: + name: Section* with short name + short: section_star_short_name +- part: part section test +- chapter: chapter section test +- section: section section test +- subsection: subsection section test +- subsubsection: subsubsection section test +- paragraph: paragraph section test +- subparagraph: subparagraph section test \ No newline at end of file diff --git a/test/test_content/sections_short.control b/test/test_content/sections_short.control deleted file mode 100644 index 706e86b8..00000000 --- a/test/test_content/sections_short.control +++ /dev/null @@ -1 +0,0 @@ -["section:(tradi)Traditional", "exsong.sg", "section*:Example", "texsong.tsg", "chordpro.csg", "exsong.sg"] \ No newline at end of file diff --git a/test/test_content/sections_short.source b/test/test_content/sections_short.source deleted file mode 100644 index 8f6c0582..00000000 --- a/test/test_content/sections_short.source +++ /dev/null @@ -1,8 +0,0 @@ -- section: - name: Traditional - short: tradi -- "exsong.sg" -- section*: Example -- "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 e2a48496..83ea5089 100644 --- a/test/test_content/test_content.py +++ b/test/test_content/test_content.py @@ -78,10 +78,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): return files.path2posix(files.relpath(elem.song.fullpath, songpath)) 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) + return elem.render(None)[1:] elif isinstance(elem, songsection.SongSection): return "{}:{}".format(elem.keyword, elem.name)