Back to index

moin  1.9.0~rc2
Public Member Functions
test_html.TestHTMLWidgets Class Reference

List of all members.

Public Member Functions

def testCreate
def testInvalidAttributes
def testCompositeElements

Detailed Description

widget.html: testing html widgets

Definition at line 13 of file test_html.py.


Member Function Documentation

widget.html: append to and extend composite element

Definition at line 42 of file test_html.py.

00042 
00043     def testCompositeElements(self):
00044         """widget.html: append to and extend composite element"""
00045         html._SORT_ATTRS = 1
00046         element = html.P()
00047 
00048         actions = (
00049             # action, data, expected
00050             (element.append,
00051              html.Text('Text & '),
00052              '<p>Text &amp; </p>'),
00053             (element.append,
00054              html.Text('more text. '),
00055              '<p>Text &amp; more text. </p>'),
00056             (element.extend,
00057              (html.Text('And then '), html.Text('some.')),
00058              '<p>Text &amp; more text. And then some.</p>'),
00059             )
00060 
00061         for action, data, expected in actions:
00062             action(data)
00063             result = unicode(element)
00064             assert result == expected

widget.html: creating html widgets

TO DO: add tests for all elements by HTML 4 spec.

Definition at line 16 of file test_html.py.

00016 
00017     def testCreate(self):
00018         """widget.html: creating html widgets
00019 
00020         TO DO: add tests for all elements by HTML 4 spec.
00021         """
00022         tests = (
00023             # description, call, expected
00024             ('Create text', html.Text('<br> &'), '&lt;br&gt; &amp;'),
00025             ('Create raw html', html.Raw('<br> &amp;'), '<br> &amp;'),
00026             ('Create br', html.BR(), '<br>'),
00027             ('Create hr', html.HR(), '<hr>'),
00028             ('Create p', html.P(), '<p></p>'),
00029             )
00030 
00031         for description, obj, expected in tests:
00032             result = unicode(obj)
00033             assert result == expected

widget.html: invalid attributes raises exception

TO DO: add tests for all elements by HTML 4 spec.

Definition at line 34 of file test_html.py.

00034 
00035     def testInvalidAttributes(self):
00036         """widget.html: invalid attributes raises exception
00037 
00038         TO DO: add tests for all elements by HTML 4 spec.
00039         """
00040         py.test.raises(AttributeError, html.BR, name='foo')
00041 


The documentation for this class was generated from the following file: