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:
parent
4a9e5f4b15
commit
a6b31813f7
5 changed files with 103 additions and 46 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue