Exemplo n.º 1
0
def test_from_string() -> None:
    """Tests that UID can be deserialized by a human readable string."""

    uid_str = "fb1bb067-5bb7-4c49-bece-e700ab0a1514"
    uid = UID.from_string(value=uid_str)
    uid_comp = UID(value=uuid.UUID(int=333779996850170035686993356951732753684))

    assert str(uid) == "<UID: fb1bb0675bb74c49becee700ab0a1514>"
    assert uid.__repr__() == "<UID: fb1bb0675bb74c49becee700ab0a1514>"
    assert uid == uid_comp
Exemplo n.º 2
0
def test_from_string_exception() -> None:
    """Tests that UID throws exception when invalid string is given."""

    with pytest.raises(Exception):
        UID.from_string(value="Hello world")