Skip to content

Commit 7904925

Browse files
committed
Further tests for deserializing Python objects during inject_plugin
1 parent 01219bd commit 7904925

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

test/unit/test_mkdocs_utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,19 +185,21 @@ def test_round_trip(self):
185185
self.assertEqual(self.out.getvalue(), expected)
186186

187187
def test_python_tag(self):
188-
cfg = 'plugins:\n - foo:\n option: !!python/none'
188+
cfg = ('plugins:\n'
189+
' - foo:\n option: !!python/none\n' +
190+
' - bar:\n option: !!python/name:io.StringIO')
189191
with mock.patch('builtins.open',
190192
mock_open_files({'mkdocs.yml': cfg})), \
191193
mock.patch('mike.mkdocs_utils.NamedTemporaryFile',
192194
return_value=self.out), \
193195
mock.patch('os.remove') as mremove:
194196
with mkdocs_utils.inject_plugin('mkdocs.yml') as f:
195197
self.assertEqual(f, self.out.name)
196-
newcfg = yaml.safe_load(self.out.getvalue())
198+
newcfg = yaml.load(self.out.getvalue(), yaml.Loader)
197199
mremove.assert_called_once()
198200

199201
self.assertEqual(newcfg, {'plugins': [
200-
'mike', {'foo': {'option': None}},
202+
'mike', {'foo': {'option': None}}, {'bar': {'option': StringIO}},
201203
]})
202204

203205
def test_inherit(self):

0 commit comments

Comments
 (0)