3
0
Fork 0

fix: add make_str_uuid() to disambiguate what callers want

first step on the way to fixing `make_uuid()` so it always returns a
proper UUID instance
This commit is contained in:
Lance Edgar 2025-12-21 01:17:56 -06:00
parent 4a9e5f4b15
commit a6b31813f7
5 changed files with 103 additions and 46 deletions

View file

@ -510,14 +510,19 @@ app_title = WuttaTest
self.assertIsInstance(dt, datetime.datetime)
self.assertIsNone(dt.tzinfo)
def test_make_uuid(self):
uuid = self.app.make_uuid()
def test_make_str_uuid(self):
uuid = self.app.make_str_uuid()
self.assertEqual(len(uuid), 32)
def test_make_true_uuid(self):
uuid = self.app.make_true_uuid()
self.assertIsInstance(uuid, _uuid.UUID)
def test_make_uuid(self):
# TODO: temporary behavior
uuid = self.app.make_uuid()
self.assertEqual(len(uuid), 32)
def test_progress_loop(self):
def act(obj, i):

View file

@ -4,6 +4,7 @@ import datetime
import sys
from unittest import TestCase
from unittest.mock import patch, MagicMock
from uuid import UUID
import pytest
@ -332,9 +333,17 @@ class TestMakeUTC(TestCase):
class TestMakeUUID(TestCase):
def test_basic(self):
def test_str_uuid(self):
uuid = mod.make_str_uuid()
self.assertIsInstance(uuid, str)
def test_true_uuid(self):
uuid = mod.make_true_uuid()
self.assertIsInstance(uuid, UUID)
def test_temporary_behavior(self):
uuid = mod.make_uuid()
self.assertEqual(len(uuid), 32)
self.assertIsInstance(uuid, str)
class TestParseBool(TestCase):