Esempio n. 1
0
def test_unsupported_mixin_comparison_conditions(op, typedef):
    class Model(BaseModel):
        id = Column(Integer, hash_key=True)

    column = Column(typedef, dynamo_name="d")
    column.model = Model
    column._name = "c"
    with pytest.raises(InvalidCondition):
        op(column, "value")
Esempio n. 2
0
def test_column_repr_path():
    column = Column(Integer, name="f")
    column.model = User
    column.model_name = "foo"

    assert repr(
        column[3]["foo"]["bar"][2][1]) == "<Proxy[User.foo[3].foo.bar[2][1]]>"

    column.hash_key = True
    assert repr(
        column[3]["foo"]["bar"][2][1]) == "<Proxy[User.foo[3].foo.bar[2][1]]>"
Esempio n. 3
0
def test_unsupported_mixin_function_conditions(op, typedefs, args):
    class Model(BaseModel):
        id = Column(Integer, hash_key=True)

    for typedef in typedefs:
        column = Column(typedef, dynamo_name="d")
        column.model = Model
        column._name = "c"
        with pytest.raises(InvalidCondition):
            getattr(column, op)(*args)
            column.begins_with(object())
Esempio n. 4
0
def test_column_repr():
    column = Column(Integer, name="f")
    column.model = User
    column.model_name = "foo"
    assert repr(column) == "<Column[User.foo]>"

    column.hash_key = True
    assert repr(column) == "<Column[User.foo=hash]>"

    column.hash_key = False
    column.range_key = True
    assert repr(column) == "<Column[User.foo=range]>"