Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/fastuuid/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package:
name: fastuuid
version: 0.14.0
top-level:
- fastuuid
source:
url: https://files.pythonhosted.org/packages/source/f/fastuuid/fastuuid-0.14.0.tar.gz
sha256: 178947fc2f995b38497a74172adee64fdeb8b7ec18f2a5934d037641ba265d26
about:
home: null
PyPI: https://pypi.org/project/fastuuid
summary: Python bindings to Rust's UUID library.
license: null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requirement:
  executable:
    - rustup

We need to tell that this is a rust package to setup the toolchain.

extra:
recipe-maintainers:
- PUT_YOUR_GITHUB_USERNAME_HERE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- PUT_YOUR_GITHUB_USERNAME_HERE
- hoodmane

64 changes: 64 additions & 0 deletions packages/fastuuid/test_fastuuid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
from pytest_pyodide import run_in_pyodide


@run_in_pyodide(packages=["fastuuid"])
def test_fastuuid(selenium):
import pytest
from fastuuid import UUID, uuid1, uuid3, uuid4, uuid5, uuid7, uuid_v1mc
import re
import uuid
UUID_REGEX = re.compile("[0-F]{8}-([0-F]{4}-){3}[0-F]{12}", re.I)


with pytest.raises(
TypeError,
match="one of the hex, bytes, bytes_le, fields, or int arguments must be given",
):
UUID()

expected = uuid4()
actual = UUID(str(expected))
other = uuid4()

assert expected == actual
assert expected != other
a = UUID(int=10)
b = UUID(int=20)
c = UUID(int=20)

assert a < b
assert b > a
assert a <= b
assert b >= a
assert c <= c
assert c >= c

expected = uuid_v1mc()
assert expected.version == 1
assert expected.variant == "specified in RFC 4122"
assert UUID_REGEX.match(str(expected))
assert str(expected) == str(uuid.UUID(str(expected)))

expected = uuid3(uuid4(), b"foo")
assert expected.version == 3
assert expected.variant == "specified in RFC 4122"
assert UUID_REGEX.match(str(expected))
assert str(expected) == str(uuid.UUID(str(expected)))

expected = uuid4()
assert expected.version == 4
assert expected.variant == "specified in RFC 4122"
assert UUID_REGEX.match(str(expected))
assert str(expected) == str(uuid.UUID(str(expected)))

expected = uuid5(uuid4(), b"foo")
assert expected.version == 5
assert expected.variant == "specified in RFC 4122"
assert UUID_REGEX.match(str(expected))
assert str(expected) == str(uuid.UUID(str(expected)))

expected = uuid7()
assert expected.version == 7
assert expected.variant == "specified in RFC 4122"
assert UUID_REGEX.match(str(expected))
assert str(expected) == str(uuid.UUID(str(expected)))
Loading