Ejemplo n.º 1
0
 def test_pisa_tag_will_set_attrs_on_init(self):
     dom = minidom.parseString("<unit>test</unit>")
     element = dom.getElementsByTagName("unit")[0]
     attrs = AttrContainer({})
     instance = tags.pisaTag(element, attrs)
     self.assertEqual(instance.node, element)
     self.assertEqual(instance.tag, "unit")
     self.assertEqual(instance.attr, {})
Ejemplo n.º 2
0
 def setUp(self):
     self.element = self._getElement("rootElement")
     self.attrs = AttrContainer({
         "border": "",
         "bordercolor": "",
         "cellpadding": "",
         "align": "",
         "repeat": "",
         "width": ""
     })
Ejemplo n.º 3
0
    def test_td_tag_doesnt_collapse_when_empty(self):
        dom = minidom.parseString("<td></td>")
        element = dom.getElementsByTagName("td")[0]
        attrs = AttrContainer({
            'align': None,
            'colspan': None,
            'rowspan': None,
            'width': None,
            'valign': None,
        })
        context = pisaContext([])
        table_data = tables.TableData()
        table_data.col = 0
        table_data.row = 0
        table_data.colw = []
        table_data.rowh = []
        context.tableData = table_data
        context.frag.paddingLeft = 0
        context.frag.paddingRight = 0

        instance = tables.pisaTagTD(element, attrs)
        instance.start(context)

        self.assertEqual(context.tableData.colw, [None])