askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
test_object_ids.py · 672 bytes · 22 lines
| 1 | from uuid import UUID |
| 2 | |
| 3 | import object_ids |
| 4 | |
| 5 | |
| 6 | def test_new_uuid4_returns_canonical_uuid4_string(): |
| 7 | value = object_ids.new_uuid4() |
| 8 | |
| 9 | parsed = UUID(value) |
| 10 | assert parsed.version == 4 |
| 11 | assert str(parsed) == value |
| 12 | |
| 13 | |
| 14 | def test_normalize_uuid4_accepts_only_uuid4_values(): |
| 15 | value = object_ids.new_uuid4() |
| 16 | |
| 17 | assert object_ids.normalize_uuid4(value.upper()) == value |
| 18 | assert object_ids.normalize_uuid4("00000000-0000-0000-0000-000000000000") is None |
| 19 | assert object_ids.normalize_uuid4("not-a-uuid") is None |
| 20 | assert object_ids.normalize_uuid4(None) is None |
| 21 | assert object_ids.is_uuid4(value) is True |
| 22 | assert object_ids.is_uuid4("not-a-uuid") is False |