Skip to content

Commit

Permalink
removed get_metadata from formex + set up parse function without othe…
Browse files Browse the repository at this point in the history
…r parameters
  • Loading branch information
AlessioNar committed Dec 27, 2024
1 parent ec2070c commit 7df6df3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
18 changes: 6 additions & 12 deletions tests/parsers/test_formex.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ def test_get_root(self):
self.assertIsNotNone(self.parser.root, "Root element should not be None")

def test_get_preface(self):
self.maxDiff = None # Allow full diff if needed



self.parser.get_preface()
expected = (
"Commission Implementing Regulation (EU) No 1319/2011 of 15 December 2011 "
Expand All @@ -34,9 +32,8 @@ def test_get_preface(self):

def test_get_preamble(self):
"""Test parsing the preamble section with quotations and numbered considerations in Formex4Parser."""
self.maxDiff = None # Allow full diff if needed
self.parser.get_preamble(preamble_xpath='.//PREAMBLE', notes_xpath='.//NOTE')

self.parser.get_preamble()
self.assertIsNotNone(self.parser.preamble)

def test_get_formula(self):
Expand All @@ -46,13 +43,10 @@ def test_get_formula(self):
pass

def test_get_citations(self):

self.maxDiff = None # Allow full diff if needed
self.parser.get_preamble(preamble_xpath='.//PREAMBLE', notes_xpath='.//NOTE')


self.parser.get_preamble()
self.parser.get_citations()


citations = [
{'eId': 0, 'text': "Having regard to the Treaty on the Functioning of the European Union,"},
{"eId": 1, 'text':"Having regard to Council Regulation (EC) No 1234/2007 of 22 October 2007 establishing a common organisation of agricultural markets and on specific provisions for certain agricultural products (Single CMO Regulation) , and in particular Article 143 thereof,"},
Expand All @@ -64,8 +58,8 @@ def test_get_citations(self):

def test_get_recitals(self):
"""Test parsing the preamble section with quotations and numbered considerations in Formex4Parser."""
self.maxDiff = None # Allow full diff if needed
self.parser.get_preamble(preamble_xpath='.//PREAMBLE', notes_xpath='.//NOTE')

self.parser.get_preamble()
self.parser.get_recitals()

recitals = [
Expand Down
6 changes: 4 additions & 2 deletions tulit/parsers/formex.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def __init__(self):
def get_preface(self):
return super().get_preface(preface_xpath='.//TITLE', paragraph_xpath='.//P')

def get_preamble(self):
return super().get_preamble(preamble_xpath='.//PREAMBLE', notes_xpath='.//NOTE')

def get_formula(self):
"""
Extracts the formula from the preamble.
Expand Down Expand Up @@ -163,9 +166,8 @@ def parse(self, file):
self.load_schema('formex4.xsd')
self.validate(file, format = 'Formex 4')
self.get_root(file)
self.get_metadata()
self.get_preface()
self.get_preamble(preamble_xpath='.//PREAMBLE', notes_xpath='.//NOTE')
self.get_preamble()
self.get_body()
self.get_chapters()
self.get_articles()

0 comments on commit 7df6df3

Please sign in to comment.