Skip to content

Commit 6eb2a56

Browse files
committed
Add tests for parsel.selector._load_object
1 parent 48c835f commit 6eb2a56

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_selector.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from parsel import Selector
99
from parsel.selector import (
10+
_load_object,
1011
CannotRemoveElementWithoutRoot,
1112
CannotRemoveElementWithoutParent,
1213
)
@@ -913,3 +914,18 @@ def test_set(self):
913914
//div[@itemtype="http://schema.org/Event"]
914915
//*[@itemscope]/*/@itemprop)''').extract(),
915916
[u'url', u'name', u'startDate', u'location', u'offers'])
917+
918+
919+
class LoadObjectTestCase(unittest.TestCase):
920+
921+
def test_incomplete_path(self):
922+
with self.assertRaises(ValueError):
923+
object = _load_object('parsel')
924+
925+
def test_inexistent_module(self):
926+
with self.assertRaises(ModuleNotFoundError):
927+
object = _load_object('parsel.inexistent.inexistent')
928+
929+
def test_inexistent_object(self):
930+
with self.assertRaises(NameError):
931+
object = _load_object('parsel.parser.inexistent')

0 commit comments

Comments
 (0)