class SelectorTemplateTestCase(BaseTestCase): def setUp(self): super(SelectorTemplateTestCase, self).setUp() self.p = Page() self.p.selectors["foo"] = "xpath=//foo[{n}]/{el}" def test_basic(self): self.assertEquals("xpath=//foo[3]/p", self.p.resolve_selector("foo", n=3, el="p")) def test_too_many_args(self): self.assertEquals("xpath=//foo[3]/p", self.p.resolve_selector("foo", n=3, el="p", boo="bat")) @raises(exceptions.SelectorError) def test_not_enough_args(self): self.p.resolve_selector("foo", n=3) @raises def test_wrong_args(self): self.p.resolve_selector("foo", n=3, ep="p")
def setUp(self): super(SelectorTemplateTestCase, self).setUp() self.p = Page() self.p.selectors["foo"] = "xpath=//foo[{n}]/{el}"