Esempio n. 1
0
    def test_incomplete(self):
        class Test:
            def __init__(self):
                self.foo = 'foo'
                self.bar = 'bar'

            class HtmlREPR(TempyREPR):
                pass

        with self.assertRaises(IncompleteREPRError):
            a = Span()(Test())
            a.render()
Esempio n. 2
0
    def test_container_view(self):
        test_instance = self.test_model()
        a = Div()(test_instance)
        self.assertEqual(a.render(), '<div><p>foo</p><p>bar</p></div>')

        b = Span()(Div()(test_instance))
        self.assertEqual(b.render(),
                         '<span><div><p>foo</p><p>bar</p></div></span>')
Esempio n. 3
0
    def test_nameless_view(self):
        class Test:
            def __init__(self):
                self.foo = 'foo'
                self.bar = 'bar'

            class HtmlREPR(TempyREPR):
                def repr(self):
                    self(Div()(self.foo), Div()(self.bar))

        test_instance = Test()
        a = Span()(test_instance)
        self.assertEqual(a.render(),
                         '<span><div>foo</div><div>bar</div></span>')