Browse Source

Improve section testing

pull/190/head
Oliverpool 9 years ago
parent
commit
5b40ffbfd1
  1. 12
      test/test_content/sections.control
  2. 22
      test/test_content/sections.source
  3. 1
      test/test_content/sections_short.control
  4. 8
      test/test_content/sections_short.source
  5. 5
      test/test_content/test_content.py

12
test/test_content/sections.control

@ -1 +1,11 @@
["section:Traditional", "exsong.sg", "section:Example", "texsong.tsg", "chordpro.csg", "exsong.sg"]
- "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}"

22
test/test_content/sections.source

@ -1,6 +1,16 @@
- section: Traditional
- "exsong.sg"
- section: Example
- "texsong.tsg"
- "chordpro.csg"
- "exsong.sg"
- 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

1
test/test_content/sections_short.control

@ -1 +0,0 @@
["section:(tradi)Traditional", "exsong.sg", "section*:Example", "texsong.tsg", "chordpro.csg", "exsong.sg"]

8
test/test_content/sections_short.source

@ -1,8 +0,0 @@
- section:
name: Traditional
short: tradi
- "exsong.sg"
- section*: Example
- "texsong.tsg"
- "chordpro.csg"
- "exsong.sg"

5
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)

Loading…
Cancel
Save