Exemple #1
0
    def test_validate_result_is_an_element(self):
        @fragment.register('bad')
        def foo():
            return 'foo'

        with pytest.raises(TypeError):
            print(fragment('bad'))
Exemple #2
0
 def test_fragment_error(self):
     with pytest.raises(FragmentNotFound):
         fragment('not-found')
Exemple #3
0
 def test_fragment_with_string_path(self, fragments):
     assert fragment('user/foo') == div('user: foo')
     assert fragment('user/bar') == div('user: bar')
Exemple #4
0
 def test_fragment_with_numeric_path(self, fragments):
     assert fragment('number/41') == div('number: 42')
     assert fragment('number/0') == div('number: 1')
Exemple #5
0
 def test_simple_fragment(self, fragments):
     assert fragment('header') == div('header')
     assert fragment('footer') == div('footer')