Skip to content

Commit

Permalink
✅ Add test testing import error
Browse files Browse the repository at this point in the history
  • Loading branch information
garlontas committed Dec 30, 2023
1 parent 42c520c commit 973038c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_xml_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,9 @@ def test_xml_loader_from_string(self):
def test_xml_loader_from_empty_string(self):
with self.assertRaises(ParseError):
len(xml('', read_from_src=True))

@patch('builtins.__import__', side_effect=ImportError('Mocked ImportError'))
def test_defusedxml_not_installed(self, mock_import):
with self.assertRaises(ImportError):
from pystreamapi.loaders import xml
xml(file_path)

0 comments on commit 973038c

Please sign in to comment.