Skip to content

Commit

Permalink
added quick test for #28
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Mar 27, 2024
1 parent 1161acb commit 82d2bde
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions folia/tests/maintest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,50 @@ def test042_table(self):
self.assertEqual( table[0][0].text(), "Naam | Universiteit" ) #text of whole row


def test042b_table(self):
"""Sanity check - Table (empty cells/rows)"""
doc = folia.Document(
string="""<?xml version="1.0" encoding="utf-8"?>
<FoLiA xmlns="http://ilk.uvt.nl/folia" version="2.5.1" xml:id="example">
<text>
<table xml:id="example.table.1">
<row>
<cell />
<cell><t>right 1</t></cell>
</row>
<row>
<cell><t>left 2</t></cell>
<cell />
</row>
<row>
<cell/>
<cell/>
</row>
</table>
</text>
</FoLiA>
""",
autodeclare=True,
loadsetdefinitions=False,
)
table = doc["example.table.1"]
self.assertTrue( isinstance(table, folia.Table))
self.assertTrue( isinstance(table[0], folia.Row))
self.assertEqual( len(table[0]), 2) #two cells
self.assertTrue( isinstance(table[0][0], folia.Cell))
self.assertEqual( table[0][1].text(), "right 1" )
self.assertEqual( table[0].text(), " | right 1" )
self.assertTrue( isinstance(table[1], folia.Row))
self.assertEqual( len(table[1]), 2) #two cells
self.assertTrue( isinstance(table[1][0], folia.Cell))
self.assertTrue( isinstance(table[1][1], folia.Cell))
self.assertEqual( table[1][0].text(), "left 2" )
self.assertEqual( table[1].text(), "left 2 | " )
self.assertEqual( len(table[2]), 2) #two cells
self.assertTrue( isinstance(table[2][0], folia.Cell))
self.assertEqual( table[2].text(), " | | " )


def test043_string(self):
"""Sanity check - String"""
s = self.doc["sandbox.3.head"]
Expand Down

0 comments on commit 82d2bde

Please sign in to comment.