Beispiel #1
0
class RefsFinderENGTestCase(TestCase):
    fixtures = ['languages_data', 'countries']

    def setUp(self):
        self.work = Work(frbr_uri='/akn/za/act/1991/1')
        self.finder = RefsFinderENG()
        self.eng = Language.for_code('eng')
        self.maxDiff = None

    def test_find_simple(self):
        document = Document(
            work=self.work,
            document_xml=document_fixture(
                xml="""
        <section eId="sec_1">
          <num>1.</num>
          <heading>Tester</heading>
          <paragraph eId="sec_1.paragraph-0">
            <content>
              <p>Something to do with Act no 22 of 2012.</p>
              <p>And another thing about Act 4 of 1998.</p>
            </content>
          </paragraph>
        </section>"""
            ),
            language=self.eng)

        expected = Document(
            work=self.work,
            document_xml=document_fixture(
                xml="""
        <section eId="sec_1">
          <num>1.</num>
          <heading>Tester</heading>
          <paragraph eId="sec_1.paragraph-0">
            <content>
              <p>Something to do with Act <ref href="/akn/za/act/2012/22">no 22 of 2012</ref>.</p>
              <p>And another thing about Act <ref href="/akn/za/act/1998/4">4 of 1998</ref>.</p>
            </content>
          </paragraph>
        </section>"""
            ),
            language=self.eng)

        self.finder.find_references_in_document(document)
        root = etree.fromstring(expected.content)
        expected.content = etree.tostring(root, encoding='utf-8').decode('utf-8')
        self.assertEqual(expected.content, document.content)
Beispiel #2
0
 def setUp(self):
     self.work = Work(frbr_uri='/akn/za/act/1991/1')
     self.finder = RefsFinderENG()
     self.eng = Language.for_code('eng')
     self.maxDiff = None
Beispiel #3
0
 def setUp(self):
     self.finder = RefsFinderENG()
     self.eng = Language.for_code('eng')
     self.maxDiff = None