def test_parse_dict(): trait = Dict(Str, Int) x = dict(foo=1, bar=2) for y in [ parse_dict(trait, '{foo: 1, bar: 2}'), parse_dict(trait, '{foo=1, bar=2}'), parse_dict(trait, 'foo:1,bar:2') ]: assert_equal(x, y)
def test_nested_sequence(): trait = List(List(Int)) x = [[1, 2], [3, 4]] for y in [ parse_list(trait, '[[1, 2], [3, 4]]'), parse_list(trait, '[1,2],[3,4]') ]: assert_equal(x, y) trait = Dict(Str, List(Int)) assert_equal(dict(foo=[1,2], bar=[3,4]), parse_dict(trait, 'foo: [1,2], bar: [3,4]'))