Ejemplo n.º 1
0
def test_map_path():
    """To support paths in condition expressions, __getitem__ must return another Type.

    Unlike List, Map can return a different Type for each of its keys."""
    foo_type = UUID()
    bar_type = Integer()
    bool_type = Boolean()
    typedef = Map(**{
        "foo": foo_type,
        "bar": bar_type,
        "bool": bool_type,
    })
    assert typedef["foo"] is foo_type
    assert typedef["bar"] is bar_type
    assert typedef["bool"] is bool_type
Ejemplo n.º 2
0
def test_list_path(key):
    """To support paths in condition expressions, __getitem__ must return another Type.  List only has one Type."""
    inner = UUID()
    typedef = List(inner)
    assert typedef[key] is inner
Ejemplo n.º 3
0
def test_uuid():
    typedef = UUID()
    uuid_obj = uuid.uuid4()
    uuid_str = str(uuid_obj)
    symmetric_test(typedef, (uuid_obj, uuid_str))