Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRDC-H Decimals vs YAML from https://github.com/cancerDHC/ccdhmodel/issues/131 #44

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions decimal_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import crdch_model as cm
from linkml_runtime.dumpers import yaml_dumper


def test_dumps_vcc():
vcc_obs = cm.Observation(observation_type=cm.CodeableConcept(), value_codeable_concept=cm.CodeableConcept())
vcc_dump = yaml_dumper.dumps(vcc_obs)
# print statements ignored by default in passing pytests?
# https://stackoverflow.com/questions/24617397/how-to-print-to-console-in-pytest
# try -s argument or PyCharm specific configuration?
print(vcc_dump)
assert len(vcc_dump) > 0


def test_dumps_decimal():
decimal_obs = cm.Observation(observation_type=cm.CodeableConcept(), value_decimal="1.23")
vd_dump = ""
gaurav marked this conversation as resolved.
Show resolved Hide resolved
try:
vd_dump = yaml_dumper.dumps(decimal_obs)
except Exception as e:
# PEP 8: E722 do not use bare 'except'
print(f"{e}\nCouldn't dump CRDC-H decimal value to YAML string")
assert len(vd_dump) > 0