Commit 3fd939c
Fix convert_file for Python 3.13 (#384)
As of python/cpython#117589 (at least),
`Path.glob` returns an `Iterator` rather than `Generator` (which
inherits from `Iterator`). `convert_file` doesn't need to care about
this distinction; it can reasonably accept both.
This previously caused a test failure along these lines:
______________________________________________________ TestPypandoc.test_basic_conversion_from_file_pattern_pathlib_glob _______________________________________________________
self = <tests.TestPypandoc testMethod=test_basic_conversion_from_file_pattern_pathlib_glob>
def test_basic_conversion_from_file_pattern_pathlib_glob(self):
received_from_str_filename_input = pypandoc.convert_file("./*.md", 'html').lower()
> received_from_path_filename_input = pypandoc.convert_file(Path(".").glob("*.md"), 'html').lower()
tests.py:654:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
source_file = <map object at 0x7f83952c9420>, to = 'html', format = None, extra_args = (), encoding = 'utf-8', outputfile = None, filters = None, verify_format = True
sandbox = False, cworkdir = '/home/cjwatson/src/python/pypandoc', sort_files = True
[...]
if not _identify_path(discovered_source_files):
> raise RuntimeError("source_file is not a valid path")
E RuntimeError: source_file is not a valid path
pypandoc/__init__.py:201: RuntimeError
Co-authored-by: Jessica Tegner <jessica@jessicategner.com>1 parent 32d3a40 commit 3fd939c
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | | - | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| |||
0 commit comments