Package: pypandoc / 1.4+ds0-1.1

0003-Fix-tests-with-newer-pandoc.patch Patch series | 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
From ea9d2642f91489646b56faf13d8a852e7b737b0b Mon Sep 17 00:00:00 2001
From: Jan Schulz <jasc@gmx.net>
Date: Fri, 6 Apr 2018 02:03:32 +0200
Subject: [PATCH] Fix tests with newer pandoc

---
 tests.py | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

--- a/tests.py
+++ b/tests.py
@@ -134,7 +134,7 @@
         self.assertTrue(isinstance(version, pypandoc.string_types))
         major = int(version.split(".")[0])
         # according to http://pandoc.org/releases.html there were only two versions 0.x ...
-        self.assertTrue(major in [0, 1])
+        self.assertTrue(major in [0, 1, 2])
 
     def test_converts_valid_format(self):
         self.assertEqualExceptForNewlineEnd(pypandoc.convert("ok", format='md', to='rest'), 'ok')
@@ -150,7 +150,7 @@
         self.assertRaises(RuntimeError, f)
 
     def test_basic_conversion_from_file(self):
-        with closed_tempfile('.md', text='#some title\n') as file_name:
+        with closed_tempfile('.md', text='# some title\n') as file_name:
             expected = u'some title{0}=========={0}{0}'.format(os.linesep)
             received = pypandoc.convert(file_name, 'rst')
             self.assertEqualExceptForNewlineEnd(expected, received)
@@ -158,7 +158,7 @@
     def test_basic_conversion_from_file_url(self):
         # this currently doesn't work: https://github.com/jgm/pandoc/issues/3196
         return
-        with closed_tempfile('.md', text='#some title\n') as file_name:
+        with closed_tempfile('.md', text='# some title\n') as file_name:
             expected = u'some title{0}=========={0}{0}'.format(os.linesep)
             # this keeps the : (which should be '|' on windows but pandoc
             # doesn't like it
@@ -176,14 +176,14 @@
 
     def test_convert_with_custom_writer(self):
         lua_file_content = self.create_sample_lua()
-        with closed_tempfile('.md', text='#title\n') as file_name:
+        with closed_tempfile('.md', text='# title\n') as file_name:
             with closed_tempfile('.lua', text=lua_file_content, dir_name="foo-bar+baz") as lua_file_name:
                 expected = u'<h1 id="title">title</h1>{0}'.format(os.linesep)
                 received = pypandoc.convert_file(file_name, lua_file_name)
                 self.assertEqualExceptForNewlineEnd(expected, received)
 
     def test_basic_conversion_from_file_with_format(self):
-        with closed_tempfile('.md', text='#some title\n') as file_name:
+        with closed_tempfile('.md', text='# some title\n') as file_name:
             expected = u'some title{0}=========={0}{0}'.format(os.linesep)
             received = pypandoc.convert(file_name, 'rst', format='md')
             self.assertEqualExceptForNewlineEnd(expected, received)
@@ -193,11 +193,11 @@
 
     def test_basic_conversion_from_string(self):
         expected = u'some title{0}=========={0}{0}'.format(os.linesep)
-        received = pypandoc.convert('#some title', 'rst', format='md')
+        received = pypandoc.convert('# some title', 'rst', format='md')
         self.assertEqualExceptForNewlineEnd(expected, received)
 
         expected = u'some title{0}=========={0}{0}'.format(os.linesep)
-        received = pypandoc.convert_text('#some title', 'rst', format='md')
+        received = pypandoc.convert_text('# some title', 'rst', format='md')
         self.assertEqualExceptForNewlineEnd(expected, received)
 
     def test_conversion_with_markdown_extensions(self):
@@ -215,16 +215,16 @@
     def test_conversion_from_markdown_with_extensions(self):
         input = u'~~strike~~'
         expected_with_extension = u'<p><del>strike</del></p>'
-        expected_without_extension = u'<p><sub><sub>strike</sub></sub></p>'
+        #expected_without_extension = u'<p><sub><sub>strike</sub></sub></p>'
         received_with_extension = pypandoc.convert(input, 'html', format=u'markdown+strikeout')
-        received_without_extension = pypandoc.convert(input, 'html', format=u'markdown-strikeout')
+        #received_without_extension = pypandoc.convert(input, 'html', format=u'markdown-strikeout')
         self.assertEqualExceptForNewlineEnd(expected_with_extension, received_with_extension)
-        self.assertEqualExceptForNewlineEnd(expected_without_extension, received_without_extension)
+        #self.assertEqualExceptForNewlineEnd(expected_without_extension, received_without_extension)
 
     def test_basic_conversion_to_file(self):
         with closed_tempfile('.rst',) as file_name:
             expected = u'some title{0}=========={0}{0}'.format(os.linesep)
-            received = pypandoc.convert('#some title\n', to='rst', format='md', outputfile=file_name)
+            received = pypandoc.convert('# some title\n', to='rst', format='md', outputfile=file_name)
             self.assertEqualExceptForNewlineEnd("", received)
             with io.open(file_name) as f:
                 written = f.read()
@@ -232,7 +232,7 @@
 
         # to odf does not work without a file
         def f():
-            pypandoc.convert('#some title\n', to='odf', format='md',
+            pypandoc.convert('# some title\n', to='odf', format='md',
                              outputfile=None)
         self.assertRaises(RuntimeError, f)
 
@@ -313,14 +313,14 @@
             expected = u'some title{0}=========={0}{0}'.format(os.linesep)
             # let's just test conversion (to and) from docx, testing e.g. odt
             # as well would really be testing pandoc rather than pypandoc
-            received = pypandoc.convert('#some title\n', to='docx', format='md', outputfile=file_name)
+            received = pypandoc.convert('# some title\n', to='docx', format='md', outputfile=file_name)
             self.assertEqualExceptForNewlineEnd("", received)
             received = pypandoc.convert(file_name, to='rst')
             self.assertEqualExceptForNewlineEnd(expected, received)
 
     def test_pdf_conversion(self):
         with closed_tempfile('.pdf') as file_name:
-            ret = pypandoc.convert_text('#some title\n', to='pdf', format='md', outputfile=file_name)
+            ret = pypandoc.convert_text('# some title\n', to='pdf', format='md', outputfile=file_name)
             assert ret == ""
             with io.open(file_name, mode='rb') as f:
                 written = f.read()
@@ -329,21 +329,21 @@
 
         def f():
             # needs an outputfile
-            pypandoc.convert_text('#some title\n', to='pdf', format='md')
+            pypandoc.convert_text('# some title\n', to='pdf', format='md')
 
         self.assertRaises(RuntimeError, f)
 
         # outputfile needs to end in pdf
         with closed_tempfile('.WRONG') as file_name:
             def f():
-                pypandoc.convert_text('#some title\n', to='pdf', format='md', outputfile=file_name)
+                pypandoc.convert_text('# some title\n', to='pdf', format='md', outputfile=file_name)
 
             self.assertRaises(RuntimeError, f)
 
         # no extensions allowed
         with closed_tempfile('.pdf') as file_name:
             def f():
-                pypandoc.convert_text('#some title\n', to='pdf+somethign', format='md', outputfile=file_name)
+                pypandoc.convert_text('# some title\n', to='pdf+somethign', format='md', outputfile=file_name)
 
             self.assertRaises(RuntimeError, f)
 
@@ -372,7 +372,7 @@
             self.assertRaises(RuntimeError, f, filepath)
 
     def test_convert_text_with_existing_file(self):
-        with closed_tempfile('.md', text='#some title\n') as file_name:
+        with closed_tempfile('.md', text='# some title\n') as file_name:
             received = pypandoc.convert_text(file_name, 'rst', format='md')
             self.assertTrue("title" not in received)
 
@@ -383,7 +383,7 @@
     def test_depreaction_warnings(self):
         # convert itself is deprecated...
         with assert_produces_warning(DeprecationWarning):
-            pypandoc.convert('#some title\n', to='rst', format='md')
+            pypandoc.convert('# some title\n', to='rst', format='md')
 
     def create_sample_lua(self):
         args = [pypandoc.get_pandoc_path(), '--print-default-data-file', 'sample.lua']