-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic test for rewrite_all_attachment_work_components
- Loading branch information
1 parent
a4ca71a
commit 8955895
Showing
3 changed files
with
260 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<akomaNtoso xmlns="http://docs.oasis-open.org/legaldocml/ns/akn/3.0"> | ||
<act contains="singleVersion" name="act"> | ||
<meta> | ||
<identification source="#cobalt"> | ||
<FRBRWork> | ||
<FRBRthis value="/akn/za/act/2021/6/!main"/> | ||
<FRBRuri value="/akn/za/act/2021/6"/> | ||
<FRBRalias name="title" value="Work with uncommenced provisions, only one commencement so far"/> | ||
<FRBRdate date="2021" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRcountry value="za"/> | ||
<FRBRnumber value="6"/> | ||
</FRBRWork> | ||
<FRBRExpression> | ||
<FRBRthis value="/akn/za/act/2021/6/sot@2022-08-12/!main"/> | ||
<FRBRuri value="/akn/za/act/2021/6/sot@2022-08-12"/> | ||
<FRBRdate date="2022-08-12" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRlanguage language="sot"/> | ||
</FRBRExpression> | ||
<FRBRManifestation> | ||
<FRBRthis value="/akn/za/act/2021/6/sot@2022-08-12/!main"/> | ||
<FRBRuri value="/akn/za/act/2021/6/sot@2022-08-12"/> | ||
<FRBRdate date="2022-02-03" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
</FRBRManifestation> | ||
</identification> | ||
<publication date="2021-10-11" name="" number="" showAs=""/> | ||
<lifecycle source="#Laws-Africa"> | ||
<eventRef date="2021-10-20" eId="amendment-2021-10-20" source="#amendment-0-source" type="amendment"/> | ||
</lifecycle> | ||
<references source="#cobalt"> | ||
<TLCOrganization eId="Laws-Africa" href="http://localhost:8000" showAs="Laws.Africa"/> | ||
<TLCOrganization eId="cobalt" href="https://github.com/laws-africa/cobalt" showAs="cobalt"/> | ||
<passiveRef eId="amendment-0-source" href="/akn/za/act/2021/6" showAs="Work with uncommenced provisions, only one commencement so far"/> | ||
</references> | ||
</meta> | ||
<body> | ||
<chapter eId="chp_1"> | ||
<num>1</num> | ||
<heading>Heading</heading> | ||
</chapter> | ||
</body> | ||
<attachments> | ||
<attachment eId="att_1"> | ||
<heading>a heading</heading> | ||
<subheading>subheading</subheading> | ||
<doc name="annexure"> | ||
<meta> | ||
<identification source="#cobalt"> | ||
<FRBRWork> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/!annexure_1"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1"/> | ||
<FRBRalias name="title" value="Untitled"/> | ||
<FRBRdate date="2021" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRcountry value="xx-playground"/> | ||
<FRBRnumber value="1"/> | ||
</FRBRWork> | ||
<FRBRExpression> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/eng@2022-02-07/!annexure_1"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1/eng@2022-02-07"/> | ||
<FRBRdate date="2022-02-08" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRlanguage language="eng"/> | ||
</FRBRExpression> | ||
<FRBRManifestation> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/eng@2022-02-07/!annexure_1"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1/eng@2022-02-07"/> | ||
<FRBRdate date="2022-02-08" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
</FRBRManifestation> | ||
</identification> | ||
</meta> | ||
<mainBody> | ||
<p eId="att_1__p_1">some text</p> | ||
</mainBody> | ||
</doc> | ||
</attachment> | ||
<attachment eId="att_1"> | ||
<heading>a heading</heading> | ||
<subheading>subheading</subheading> | ||
<doc name="annexure"> | ||
<meta> | ||
<identification source="#cobalt"> | ||
<FRBRWork> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/!annexure_1"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1"/> | ||
<FRBRalias name="title" value="Untitled"/> | ||
<FRBRdate date="2021" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRcountry value="xx-playground"/> | ||
<FRBRnumber value="1"/> | ||
</FRBRWork> | ||
<FRBRExpression> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/eng@2022-02-07/!annexure_1"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1/eng@2022-02-07"/> | ||
<FRBRdate date="2022-02-08" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRlanguage language="eng"/> | ||
</FRBRExpression> | ||
<FRBRManifestation> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/eng@2022-02-07/!annexure_1"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1/eng@2022-02-07"/> | ||
<FRBRdate date="2022-02-08" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
</FRBRManifestation> | ||
</identification> | ||
</meta> | ||
<mainBody> | ||
<p eId="att_1__p_1">some text</p> | ||
</mainBody> | ||
</doc> | ||
</attachment> | ||
</attachments> | ||
</act> | ||
</akomaNtoso> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<akomaNtoso xmlns="http://docs.oasis-open.org/legaldocml/ns/akn/3.0"> | ||
<act contains="singleVersion" name="act"> | ||
<meta> | ||
<identification source="#cobalt"> | ||
<FRBRWork> | ||
<FRBRthis value="/akn/za/act/2021/6/!main"/> | ||
<FRBRuri value="/akn/za/act/2021/6"/> | ||
<FRBRalias name="title" value="Work with uncommenced provisions, only one commencement so far"/> | ||
<FRBRdate date="2021" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRcountry value="za"/> | ||
<FRBRnumber value="6"/> | ||
</FRBRWork> | ||
<FRBRExpression> | ||
<FRBRthis value="/akn/za/act/2021/6/sot@2022-08-12/!main"/> | ||
<FRBRuri value="/akn/za/act/2021/6/sot@2022-08-12"/> | ||
<FRBRdate date="2022-08-12" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRlanguage language="sot"/> | ||
</FRBRExpression> | ||
<FRBRManifestation> | ||
<FRBRthis value="/akn/za/act/2021/6/sot@2022-08-12/!main"/> | ||
<FRBRuri value="/akn/za/act/2021/6/sot@2022-08-12"/> | ||
<FRBRdate date="2022-02-03" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
</FRBRManifestation> | ||
</identification> | ||
<publication date="2021-10-11" name="" number="" showAs=""/> | ||
<lifecycle source="#Laws-Africa"> | ||
<eventRef date="2021-10-20" eId="amendment-2021-10-20" source="#amendment-0-source" type="amendment"/> | ||
</lifecycle> | ||
<references source="#cobalt"> | ||
<TLCOrganization eId="Laws-Africa" href="http://localhost:8000" showAs="Laws.Africa"/> | ||
<TLCOrganization eId="cobalt" href="https://github.com/laws-africa/cobalt" showAs="cobalt"/> | ||
<passiveRef eId="amendment-0-source" href="/akn/za/act/2021/6" showAs="Work with uncommenced provisions, only one commencement so far"/> | ||
</references> | ||
</meta> | ||
<body> | ||
<chapter eId="chp_1"> | ||
<num>1</num> | ||
<heading>Heading</heading> | ||
</chapter> | ||
</body> | ||
<attachments> | ||
<attachment eId="att_1"> | ||
<heading>a heading</heading> | ||
<subheading>subheading</subheading> | ||
<doc name="annexure"> | ||
<meta> | ||
<identification source="#cobalt"> | ||
<FRBRWork> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/!annexure_1"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1"/> | ||
<FRBRalias name="title" value="Untitled"/> | ||
<FRBRdate date="2021" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRcountry value="xx-playground"/> | ||
<FRBRnumber value="1"/> | ||
</FRBRWork> | ||
<FRBRExpression> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/eng@2022-02-07/!annexure_1"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1/eng@2022-02-07"/> | ||
<FRBRdate date="2022-02-08" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRlanguage language="eng"/> | ||
</FRBRExpression> | ||
<FRBRManifestation> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/eng@2022-02-07/!annexure_1"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1/eng@2022-02-07"/> | ||
<FRBRdate date="2022-02-08" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
</FRBRManifestation> | ||
</identification> | ||
</meta> | ||
<mainBody> | ||
<p eId="att_1__p_1">some text</p> | ||
</mainBody> | ||
</doc> | ||
</attachment> | ||
<attachment eId="att_1"> | ||
<heading>a heading</heading> | ||
<subheading>subheading</subheading> | ||
<doc name="annexure"> | ||
<meta> | ||
<identification source="#cobalt"> | ||
<FRBRWork> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/!annexure_2"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1"/> | ||
<FRBRalias name="title" value="Untitled"/> | ||
<FRBRdate date="2021" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRcountry value="xx-playground"/> | ||
<FRBRnumber value="1"/> | ||
</FRBRWork> | ||
<FRBRExpression> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/eng@2022-02-07/!annexure_2"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1/eng@2022-02-07"/> | ||
<FRBRdate date="2022-02-08" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
<FRBRlanguage language="eng"/> | ||
</FRBRExpression> | ||
<FRBRManifestation> | ||
<FRBRthis value="/akn/xx-playground/act/2021/1/eng@2022-02-07/!annexure_2"/> | ||
<FRBRuri value="/akn/xx-playground/act/2021/1/eng@2022-02-07"/> | ||
<FRBRdate date="2022-02-08" name="Generation"/> | ||
<FRBRauthor href=""/> | ||
</FRBRManifestation> | ||
</identification> | ||
</meta> | ||
<mainBody> | ||
<p eId="att_1__p_1">some text</p> | ||
</mainBody> | ||
</doc> | ||
</attachment> | ||
</attachments> | ||
</act> | ||
</akomaNtoso> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
from unittest import TestCase | ||
|
||
from lxml import etree | ||
|
||
from tests.support import ParserSupport | ||
|
||
|
||
class AttachmentWorkComponentsTestCase(ParserSupport, TestCase): | ||
maxDiff = None | ||
|
||
def rewrite_and_compare(self, xml_in, xml_out): | ||
dir = os.path.join(os.path.dirname(__file__), 'rewrite_work_components') | ||
with open(os.path.join(dir, f'{xml_in}.xml'), 'rt') as f: | ||
old_xml = f.read() | ||
with open(os.path.join(dir, f'{xml_out}.xml'), 'rt') as f: | ||
expected = f.read() | ||
|
||
xml = etree.fromstring(old_xml) | ||
self.generator.rewrite_all_attachment_work_components(xml) | ||
actual = self.tostring(xml) | ||
|
||
self.assertEqual(expected, actual) | ||
|
||
def test_fix_work_components_basic(self): | ||
self.rewrite_and_compare('basic_in', 'basic_out') |