def test__prepare_for_put(): prop = polymodel._ClassKeyProperty() value = ["test"] values = {prop._name: value} entity = unittest.mock.Mock( _projection=(prop._name, ), _values=values, spec=("_projection", "_values"), ) assert prop._prepare_for_put(entity) is None
def test__get_value(): prop = polymodel._ClassKeyProperty() value = ["test"] values = {prop._name: value} entity = unittest.mock.Mock( _projection=(prop._name, ), _values=values, spec=("_projection", "_values"), ) assert value is prop._get_value(entity)
def test__set_value(): prop = polymodel._ClassKeyProperty() with pytest.raises(TypeError): prop._set_value(None, None)
def test_constructor(): prop = polymodel._ClassKeyProperty() assert prop._name == polymodel._CLASS_KEY_PROPERTY