Skip to content

Commit

Permalink
u
Browse files Browse the repository at this point in the history
  • Loading branch information
SCHREIBER Martin committed Jan 8, 2025
1 parent 7fff99a commit 4d750d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/psyclone/parse/file_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ def get_fparser_tree(
f"File '{self._filename}' not found:\n{str(err)}")

if self._source_code_hash_sum is None:
raise PSycloneError("Hash sum should be set after loading the source")
raise PSycloneError(
"Hash sum should be set after loading the source")

# Check for cache
self._cache_load(verbose=verbose)
Expand Down Expand Up @@ -476,4 +477,3 @@ def get_psyir(self, verbose: bool = False) -> FileContainer:
# self._cache_save(verbose=verbose)

return self._psyir_node

4 changes: 3 additions & 1 deletion src/psyclone/parse/module_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

from fparser.two.Fortran2003 import Program


class ModuleInfoError(PSycloneError):
"""
PSyclone-specific exception for use when an error with the module manager
Expand Down Expand Up @@ -332,5 +333,6 @@ def view_tree(self, indent=""):
"""
retstr = ""
retstr += f"{indent}- name: '{self.name}'\n"
retstr += f"{indent}- used_module_names: {self.get_used_modules()}\n"
retstr += (f"{indent}- used_module_names:"
f" {self.get_used_modules()}\n")
return retstr
9 changes: 5 additions & 4 deletions src/psyclone/tests/parse/file_info_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ def test_file_info_source_with_bugs(tmpdir):
with pytest.raises(FileInfoFParserError) as einfo:
file_info.get_psyir(verbose=True)

assert "FileInfoFParserError: Failed to create fparser tree: at line 5" in (
assert ("FileInfoFParserError: Failed to"
" create fparser tree: at line 5") in (
str(einfo.value))

# Call it a 2nd time for coverage of not attempting to create it a 2nd time
Expand Down Expand Up @@ -476,7 +477,7 @@ def test_fparser_error():

# Catch special exception
from psyclone.parse.file_info import FileInfoFParserError
with pytest.raises(FileInfoFParserError) as einfo:
with pytest.raises(FileInfoFParserError):
file_info.get_fparser_tree()


Expand All @@ -492,5 +493,5 @@ def get_source_code():
with pytest.raises(PSycloneError) as einfo:
file_info.get_fparser_tree()

assert "Hash sum should be set after loading the source" in str(einfo.value)

assert ("Hash sum should be set"
" after loading the source") in str(einfo.value)

0 comments on commit 4d750d2

Please sign in to comment.