LEFT | RIGHT |
(no file at all) | |
1 import unittest | 1 import unittest |
2 | 2 |
3 import book_base | 3 import book_base |
4 import book_snippets | 4 import book_snippets |
5 import book_texinfo | 5 import book_texinfo |
6 | 6 |
| 7 class Dummy: |
| 8 pass |
| 9 |
7 class TestFindSnippets(unittest.TestCase): | 10 class TestFindSnippets(unittest.TestCase): |
8 def test_basic_texi(self): | 11 def test_basic_texi(self): |
9 formatter = book_texinfo.BookTexinfoOutputFormat() | 12 formatter = book_texinfo.BookTexinfoOutputFormat() |
10 | 13 global_options = Dummy() |
| 14 global_options.information = {"program_version": "1.2.3"} |
11 chunks = book_base.find_toplevel_snippets(r"""\input texinfo @c -*- codi
ng: utf-8; mode: texinfo; -*- 1 | 15 chunks = book_base.find_toplevel_snippets(r"""\input texinfo @c -*- codi
ng: utf-8; mode: texinfo; -*- 1 |
12 @setfilename texinfo-include-file.info 2 | 16 @setfilename texinfo-include-file.info 2 |
13 @settitle Include lilypond files in texinfo 3 | 17 @settitle Include lilypond files in texinfo 3 |
14 4 | 18 4 |
15 @node Top 5 | 19 @node Top 5 |
16 @top Include lilypond files in texinfo 6 | 20 @top Include lilypond files in texinfo 6 |
17 | 21 |
18 Lilypond files included in texinfo without any options: 8 | 22 Lilypond files included in texinfo without any options: 8 |
19 | 23 |
20 @lilypondfile{input/regression/les-nereides.ly} | 24 @lilypondfile{input/regression/les-nereides.ly} |
21 | 25 |
22 From a subdirectory: 12 | 26 From a subdirectory: 12 |
23 | 27 |
24 @lilypondfile{input/regression/morgenlied.ly} | 28 @lilypondfile{input/regression/morgenlied.ly} |
25 | 29 |
26 Within a lilypond block: 16 | 30 Within a lilypond block: 16 |
27 | 31 |
28 @lilypond | 32 @lilypond |
29 % \include "include/myvar.ily" | 33 % \include "include/myvar.ily" |
30 \relative c'' { c e g } | 34 \relative c'' { c e g } |
31 @end lilypond | 35 @end lilypond |
32 | 36 |
33 Include a file that includes a file: | 37 Include a file that includes a file: |
34 """, formatter, None) | 38 """, formatter, global_options) |
35 | 39 |
36 # comment | 40 # comment |
37 types = [book_snippets.Substring, | 41 types = [book_snippets.Substring, |
38 book_snippets.Snippet, # @c | 42 book_snippets.Snippet, # @c |
39 book_snippets.Substring, | 43 book_snippets.Substring, |
40 book_snippets.LilypondFileSnippet, | 44 book_snippets.LilypondFileSnippet, |
41 book_snippets.Substring, | 45 book_snippets.Substring, |
42 book_snippets.LilypondFileSnippet, | 46 book_snippets.LilypondFileSnippet, |
43 book_snippets.Substring, | 47 book_snippets.Substring, |
44 book_snippets.LilypondSnippet, | 48 book_snippets.LilypondSnippet, |
45 book_snippets.Substring] | 49 book_snippets.Substring] |
46 for i in range(0, len(types)): | 50 for i in range(0, len(types)): |
47 self.assertIsInstance(chunks[i], types[i]) | 51 self.assertIsInstance(chunks[i], types[i]) |
48 self.assertEqual(chunks[7].line_number, 18) | 52 self.assertEqual(chunks[7].line_number, 18) |
49 | 53 |
50 if __name__ == '__main__': | 54 if __name__ == '__main__': |
51 unittest.main() | 55 unittest.main() |
LEFT | RIGHT |