def test_validate_result_is_an_element(self): @fragment.register('bad') def foo(): return 'foo' with pytest.raises(TypeError): print(fragment('bad'))
def test_fragment_error(self): with pytest.raises(FragmentNotFound): fragment('not-found')
def test_fragment_with_string_path(self, fragments): assert fragment('user/foo') == div('user: foo') assert fragment('user/bar') == div('user: bar')
def test_fragment_with_numeric_path(self, fragments): assert fragment('number/41') == div('number: 42') assert fragment('number/0') == div('number: 1')
def test_simple_fragment(self, fragments): assert fragment('header') == div('header') assert fragment('footer') == div('footer')