Skip to content

Commit

Permalink
Add logic and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FedericoCeratto authored and Federico Ceratto committed Jun 22, 2023
1 parent 7c11199 commit 7796f9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fastpath/fastpath/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1649,8 +1649,12 @@ def process_measurement(msm_tup) -> None:
sw_version = measurement.get("software_version", "unknown")
test_version = g_or(measurement, "test_version", "")
test_runtime = g_or(measurement, "test_runtime", 0.0)
test_helper_address = g(measurement, "test_helpers", "backend", "address", default="")
test_helper_type = g(measurement, "test_helpers", "backend", "type", default="")
try:
test_helper_address = g(measurement, "test_helpers", "backend", "address", default="")
test_helper_type = g(measurement, "test_helpers", "backend", "type", default="")
except AttributeError:
test_helper_address = ""
test_helper_type = ""

annot = measurement.get("annotations")
if not isinstance(annot, dict):
Expand Down
4 changes: 4 additions & 0 deletions fastpath/fastpath/tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def test_extract_input_domain_meek():
def test_g():
g = fp.g
assert g({}, "x", default="v") == "v"
assert g(dict(x=dict()), "x", "y", default="v") == "v"
assert g(dict(x=dict(y=None)), "x", "y", default="v") == "v"
assert g(dict(x=dict(y="22")), "x", "y", default="v") == "22"
#assert g(dict(x="str"), "x", "y", default="v") == "v"


def test_gn():
Expand Down

0 comments on commit 7796f9f

Please sign in to comment.