예제 #1
0
파일: tests.py 프로젝트: maplambda/sharpy
    def test_element(self):
        h = sharpy.html()
        page = h.html()('An empty page')

        html = '''<html>
An empty page
</html>'''
        self.assertEqual(html, h.dumps(page))
예제 #2
0
파일: tests.py 프로젝트: maplambda/sharpy
    def test_element_attributes(self):
        h = sharpy.html()
        page = h.p(id='intro', _class="intro")('Intro paragraph')

        html = '''<p class="intro" id="intro">
Intro paragraph
</p>'''
        self.assertEqual(html, h.dumps(page))    
예제 #3
0
파일: tests.py 프로젝트: maplambda/sharpy
    def test_href(self):
        h = sharpy.html()
        page = h.a(href='https://github.com/maplambda/sharpy')('sharpy')

        html = '''<a href="https://github.com/maplambda/sharpy">
sharpy
</a>'''
        self.assertEqual(html, h.dumps(page))
예제 #4
0
파일: tests.py 프로젝트: maplambda/sharpy
    def test_nested_element(self):
        h = sharpy.html()
        page = h.html()([
            h.body()("Body text")])

        html = '''<html>
<body>
Body text
</body>
</html>'''
        self.assertEqual(html, h.dumps(page))    
예제 #5
0
파일: tests.py 프로젝트: maplambda/sharpy
    def test_multiple_nested_elements(self):
        h = sharpy.html()
        page = h.html()([
            h.body()([
                h.h1()('sharpy'),
                h.p(id='intro')('Intro paragraph')])
            ])

        html = '''<html>
<body>
<h1>
sharpy
</h1>
<p id="intro">
Intro paragraph
</p>
</body>
</html>'''
        self.assertEqual(html, h.dumps(page))