Skip to content

Commit

Permalink
REV: Tidier use of ROOT in structure.py
Browse files Browse the repository at this point in the history
As suggested in this [review comment](#60 (comment)), thanks.
  • Loading branch information
carlwilson committed Aug 29, 2024
1 parent 3d3ce76 commit 1c65fe9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions eark_validator/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

METS_NAME = 'METS.xml'
STR_REQ_PREFIX = 'CSIPSTR'
ROOT = 'root '
ROOT = 'root'
DIR_NAMES = {
'DATA': 'data',
'DESC': 'descriptive',
Expand Down Expand Up @@ -154,7 +154,7 @@ def get_representations(self) -> List[Representation]:

def get_root_results(self) -> List[Result]:
results: List[Result] = []
location: str = ROOT + self.name
location: str = _root_loc(self.name)
if not self.parser.is_archive:
results.append(test_result_from_id(3, location))
if not self.parser.has_mets():
Expand Down Expand Up @@ -195,13 +195,13 @@ def _get_schema_results(self) -> Optional[Result]:
for tests in self.representations.values():
if tests.has_schemas():
return None
return test_result_from_id(15, ROOT + self.name)
return test_result_from_id(15, _root_loc(self.name))

def _get_dox_results(self) -> Optional[Result]:
for tests in self.representations.values():
if tests.has_documentation():
return None
return test_result_from_id(16, ROOT + self.name)
return test_result_from_id(16, _root_loc(self.name))

@classmethod
def get_status(cls, results: List[Result]) -> StructureStatus:
Expand Down Expand Up @@ -240,7 +240,10 @@ def get_bad_path_results(path) -> StructResults:
})

def _get_str1_result_list(name: str) -> List[Result]:
return [ test_result_from_id(1, ROOT + str(name)) ]
return [ test_result_from_id(1, _root_loc(name)) ]

def _root_loc(name: str) -> str:
return f'{ROOT} {name}'

def validate(to_validate) -> Tuple[bool, StructResults]:
try:
Expand Down

0 comments on commit 1c65fe9

Please sign in to comment.