@@ -3642,6 +3642,45 @@ def test013e_correction(self):
3642
3642
</FoLiA>""" .format (version = folia .FOLIAVERSION , generator = 'pynlpl.formats.folia-v' + folia .LIBVERSION )
3643
3643
doc = folia .Document (string = xml , textvalidation = True )
3644
3644
3645
+ def test013f_correction (self ):
3646
+ """Validation - Text Validation with redundancy on construction"""
3647
+ #NOTE: Current library implementation won't be able to validate nested layers and will just skip those!
3648
+ doc = folia .Document (id = 'example' ,textvalidation = True )
3649
+
3650
+ text = folia .Text (doc , id = doc .id + '.text.1' )
3651
+
3652
+ text .append (
3653
+ folia .Sentence (doc ,id = doc .id + '.s.1' , text = "De site staat online . " , contents = [
3654
+ folia .Word (doc ,id = doc .id + '.s.1.w.1' , text = "De" ),
3655
+ folia .Word (doc ,id = doc .id + '.s.1.w.2' , text = "site" ),
3656
+ folia .Word (doc ,id = doc .id + '.s.1.w.3' , text = "staat" ),
3657
+ folia .Word (doc ,id = doc .id + '.s.1.w.4' , text = "online" ),
3658
+ folia .Word (doc ,id = doc .id + '.s.1.w.5' , text = "." )
3659
+ ])
3660
+ )
3661
+ doc .xmlstring () #serialisation forces validation
3662
+
3663
+ def test013g_correction (self ):
3664
+ """Validation - Text Validation with redundancy on partial construction"""
3665
+ #NOTE: Current library implementation won't be able to validate nested layers and will just skip those!
3666
+ doc = folia .Document (id = 'example' ,textvalidation = True )
3667
+
3668
+ text = folia .Text (doc , id = doc .id + '.text.1' )
3669
+
3670
+ raised = False
3671
+ try :
3672
+ text .append (
3673
+ folia .Sentence (doc ,id = doc .id + '.s.1' , text = "De site staat online . " , contents = [
3674
+ folia .Word (doc ,id = doc .id + '.s.1.w.1' , text = "De" ),
3675
+ folia .Word (doc ,id = doc .id + '.s.1.w.2' , text = "site" ),
3676
+ folia .Word (doc ,id = doc .id + '.s.1.w.3' , text = "staat" ),
3677
+ ])
3678
+ )
3679
+ except folia .InconsistentText :
3680
+ raised = True
3681
+ self .assertTrue (raised )
3682
+
3683
+
3645
3684
with io .open (FOLIAPATH + '/test/example.xml' , 'r' ,encoding = 'utf-8' ) as foliaexample_f :
3646
3685
FOLIAEXAMPLE = foliaexample_f .read ()
3647
3686
0 commit comments