generated from ApeWorX/project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
helloibis
authored
Oct 31, 2022
1 parent
43e3ce5
commit 38faac0
Showing
2 changed files
with
117 additions
and
1 deletion.
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
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,55 @@ | ||
from ethpm_types.contract_type import PCMap, PCMapItem | ||
|
||
|
||
def test_pc_map_valid(): | ||
""" | ||
Test the parsing of a valid pc-map from a compiler's output. | ||
""" | ||
pcmap = PCMap.parse_obj({"186": [10, 20, 10, 40]}).parse() | ||
|
||
keys = list(pcmap.keys()) | ||
|
||
assert len(keys) == 1 | ||
assert keys[0] == 186 | ||
assert pcmap[186] == PCMapItem(line_start=10, column_start=20, line_end=10, column_end=40) | ||
|
||
|
||
def test_pc_map_empty_line_info(): | ||
""" | ||
Test the parsing of a pc-map from a compiler's output that has empty line | ||
information. | ||
""" | ||
pcmap = PCMap.parse_obj({"186": [None, None, None, None]}).parse() | ||
|
||
keys = list(pcmap.keys()) | ||
|
||
assert len(keys) == 1 | ||
assert keys[0] == 186 | ||
assert pcmap[186] == PCMapItem( | ||
line_start=None, column_start=None, line_end=None, column_end=None | ||
) | ||
|
||
|
||
def test_pc_map_missing_line_info(): | ||
""" | ||
Test the parsing of a pc-map from a compiler's output that is entirely missing line | ||
information. | ||
""" | ||
pcmap = PCMap.parse_obj({"186": None}).parse() | ||
|
||
keys = list(pcmap.keys()) | ||
|
||
assert len(keys) == 1 | ||
assert keys[0] == 186 | ||
assert pcmap[186] == PCMapItem( | ||
line_start=None, column_start=None, line_end=None, column_end=None | ||
) | ||
|
||
|
||
def test_pc_map_empty(): | ||
""" | ||
Test the parsing of an empty pc-map from a compiler's output. | ||
""" | ||
pcmap = PCMap.parse_obj({}).parse() | ||
|
||
assert pcmap == {} |