def test___ne__(): index_prop1 = model.IndexProperty(name="d", direction="asc") index_prop2 = model.IndexProperty(name="d", direction="desc") index_prop3 = unittest.mock.sentinel.index_prop assert not index_prop1 != index_prop1 assert index_prop1 != index_prop2 assert index_prop1 != index_prop3
def test_properties(): index_prop1 = model.IndexProperty(name="a", direction="asc") index_prop2 = model.IndexProperty(name="b", direction="desc") index = model.Index(kind="F", properties=(index_prop1, index_prop2), ancestor=False) assert index.properties == (index_prop1, index_prop2)
def test___hash__(): index_props = (model.IndexProperty(name="a", direction="asc"), ) index1 = model.Index(kind="d", properties=index_props, ancestor=False) index2 = model.Index(kind="d", properties=index_props, ancestor=False) assert index1 is not index2 assert hash(index1) == hash(index2) assert hash(index1) == hash(("d", index_props, False))
def test_constructor(): index_prop = model.IndexProperty(name="a", direction="asc") index = model.Index(kind="IndK", properties=(index_prop, ), ancestor=False) assert index._kind == "IndK" assert index._properties == (index_prop, ) assert not index._ancestor
def test___repr__(): index_prop = model.IndexProperty(name="a", direction="asc") index = model.Index(kind="IndK", properties=[index_prop], ancestor=False) expected = "Index(kind='IndK', properties=[{!r}], ancestor=False)" expected = expected.format(index_prop) assert repr(index) == expected
def test___ne__(): index_props = (model.IndexProperty(name="a", direction="asc"), ) index1 = model.Index(kind="d", properties=index_props, ancestor=False) index2 = model.Index(kind="d", properties=(), ancestor=False) index3 = model.Index(kind="d", properties=index_props, ancestor=True) index4 = model.Index(kind="e", properties=index_props, ancestor=False) index5 = unittest.mock.sentinel.index assert not index1 != index1 assert index1 != index2 assert index1 != index3 assert index1 != index4 assert index1 != index5
def test___repr__(): index_prop = model.IndexProperty(name="a", direction="asc") index = model.Index(kind="IndK", properties=[index_prop], ancestor=False) index_state = model.IndexState(definition=index, state="building", id=1337) expected = ( "IndexState(definition=Index(kind='IndK', properties=[" "IndexProperty(name='a', direction='asc')], ancestor=False), " "state='building', id=1337)") assert repr(index_state) == expected
def test___hash__(): index_prop1 = model.IndexProperty(name="zip", direction="asc") index_prop2 = model.IndexProperty(name="zip", direction="asc") assert index_prop1 is not index_prop2 assert hash(index_prop1) == hash(index_prop2) assert hash(index_prop1) == hash(("zip", "asc"))
def test___repr__(): index_prop = model.IndexProperty(name="c", direction="asc") assert repr(index_prop) == "IndexProperty(name='c', direction='asc')"
def test_direction(): index_prop = model.IndexProperty(name="a", direction="desc") assert index_prop.direction == "desc"
def test_name(): index_prop = model.IndexProperty(name="b", direction="asc") assert index_prop.name == "b"
def test_constructor(): index_prop = model.IndexProperty(name="a", direction="asc") assert index_prop._name == "a" assert index_prop._direction == "asc"