def test_linkorelse_deserialize(): loe = LinkOrElse() lbu = loe.deserialize({ 'type': LinkByUID.typ, 'scope': 'foo', 'id': uuid.uuid4() }) assert isinstance(lbu, LinkByUID)
def test_linkorelse_deserialize_requires_scope_and_id(): loe = LinkOrElse() with pytest.raises(ValueError): loe.deserialize({'type': LinkByUID.typ})
def test_linkorelse_deserialize_requires_serializable(): loe = LinkOrElse() with pytest.raises(Exception): loe.deserialize({})