def test_rex_predicate(): m = freeze({'foo': {'bar': {'baz': 1}, 'bof': {'baz': 1}}}) assert m.transform(['foo', rex('^bo.*'), 'baz'], inc) == { 'foo': { 'bar': { 'baz': 1 }, 'bof': { 'baz': 2 } } }
def test_rex_with_non_string_key(): m = freeze({'foo': 1, 5: 2}) assert m.transform([rex(".*")], 5) == {'foo': 5, 5: 2}
def test_rex_predicate(): m = freeze({'foo': {'bar': {'baz': 1}, 'bof': {'baz': 1}}}) assert m.transform(['foo', rex('^bo.*'), 'baz'], inc) == {'foo': {'bar': {'baz': 1}, 'bof': {'baz': 2}}}
def test_rex_redicate(): m = freeze({"foo": {"bar": {"baz": 1}, "bof": {"baz": 1}}}) assert m.transform(["foo", rex("^bo.*"), "baz"], inc) == {"foo": {"bar": {"baz": 1}, "bof": {"baz": 2}}}