Skip to content

Commit

Permalink
Add tests of .util.unquote()
Browse files Browse the repository at this point in the history
  • Loading branch information
khaeru committed Feb 8, 2021
1 parent b74f18a commit c16b5fd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion genno/tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import pandas as pd
import pytest
from dask.core import quote

from genno import Key, Quantity
from genno.testing import assert_logs
from genno.util import collect_units, filter_concat_args
from genno.util import collect_units, filter_concat_args, unquote


def test_collect_units(ureg):
Expand All @@ -29,3 +31,17 @@ def test_filter_concat_args(caplog):
)

assert len(result) == 1


@pytest.mark.parametrize(
"value, exp",
(
# Quotable values are unwrapped
(quote(dict(foo="bar")), dict(foo="bar")),
(quote(["hello", "world"]), ["hello", "world"]),
# No effect on others
(42.0, 42.0),
),
)
def test_unquote(value, exp):
assert exp == unquote(value)

0 comments on commit c16b5fd

Please sign in to comment.