def test_target_type_error(): try: generate_uuid(123) except Exception as err: assert "string" in str(err) try: generate_uuid(123.0) except Exception as err: assert "string" in str(err)
def test_version_error(): try: generate_uuid("", 4) except Exception as err: assert "3 or 5" in str(err) try: generate_uuid("", "xx") except Exception as err: assert "3 or 5" in str(err)
def test_pass(): assert generate_uuid("")
def test_version(): assert generate_uuid("a", version=3) != generate_uuid("a", version=5)
def test_default_version(): assert generate_uuid("a", version=5) == generate_uuid("a")
def test_namespace(): assert generate_uuid("爱", "namespace")
def test_default_namespace_is_number(): assert generate_uuid("abc", 5) == generate_uuid("abc")
def test_default_namespace(): assert generate_uuid("爱", None) == generate_uuid("爱")
def test_uuid_string(): assert generate_uuid("a string. 随意的,可以有表情😁")
def test_uuid(): assert generate_uuid("abc") != generate_uuid("acb")