incorrect raw_value() for EmptyType
Closed this issue · 3 comments
kwatsen commented
Adding the following pytest to tests/test_model.py:
def test_empty_raw_value(data_model, instance):
ir = data_model.parse_resource_id("/test:contA/listA=C0FFEE,true/contD/contE")
expected = {'leafJ': [None], 'leafP': 10}
rv = instance.goto(ir).raw_value()
assert(rv == expected)
And running the following command:
pytest -sxvvk test_empty_raw_value
Produces the output:
> assert(rv == expected)
E AssertionError: assert {'leafJ': (None,), 'leafP': 10} == {'leafJ': [None], 'leafP': 10}
E Common items:
E {'leafP': 10}
E Differing items:
E {'leafJ': (None,)} != {'leafJ': [None]}
E Full diff:
E - {'leafJ': [None], 'leafP': 10}
E ? ^ -
E + {'leafJ': (None,), 'leafP': 10}
E ? ^ ++
llhotka commented
Actually, the cooked empty value is the tuple (None,)
, not list. See class EmptyType
and also docstring for from_raw. Is it a problem?
kwatsen commented
The issue isn’t with from_raw(), but rather with raw_value{}, as it outputs the cooked valve without conversion.
… On Dec 1, 2020, at 2:30 AM, Ladislav Lhotka ***@***.***> wrote:
Actually, the cooked empty value is the tuple (None,), not list. See class EmptyType and also docstring for from_raw. Is it a problem?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
llhotka commented
Fixed and test added, thanks.