Skip to content

Commit

Permalink
added tag tests (proycon/folia#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Apr 2, 2021
1 parent f34c4c9 commit 66bc220
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion folia-repo
27 changes: 27 additions & 0 deletions folia/tests/maintest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4508,6 +4508,33 @@ def test014_leadingspace(self):
"""Whitespace - Maintain leading space"""
self.assertEqual( self.doc['test.p.14'].text() , "Terwijl hij den gemiddelden prijs van een karaat geslepen op £ 8 stelde, den prijs van een steen van 2 karaat op 22 X 8 = £ 32" )

class Test_Exxx_Tags(unittest.TestCase): #Issue #93
def setUp(self):
self.doc = folia.Document(file=os.path.join(FOLIAPATH,"examples/tests/tags.2.5.0.folia.xml"))

def test_tag_sanity1(self):
"""Testing sanity of processing tags"""
e = self.doc['example.list.1.item.2']
self.assertEqual(e.tags, ['remove'])
self.assertTrue(e.hastag('remove'))
self.assertFalse(e.hastag('blah'))

def test_tag_sanity1(self):
"""Testing sanity of processing tags"""
e = self.doc['example.list.1.item.3']
self.assertEqual(e.tags, ['highlight','translate'])
self.assertTrue(e.hastag('translate'))
self.assertFalse(e.hastag('blah'))

def test_tag_sanity3(self):
"""Testing sanity when modifying tags"""
e = self.doc['example.list.1.item.3']
self.assertEqual(e.tags, ['highlight','translate'])
e.untag('highlight')
self.assertFalse(e.hastag('highlight'))
self.assertTrue(e.hastag('translate'))


with open(os.path.join(FOLIAPATH, 'examples/full-legacy.1.5.folia.xml'), 'r',encoding='utf-8') as foliaexample_f:
LEGACYEXAMPLE = foliaexample_f.read()

Expand Down

0 comments on commit 66bc220

Please sign in to comment.