3
0
Fork 0

fix: add support for date, datetime form fields

using buefy-based picker widgets etc.
This commit is contained in:
Lance Edgar 2024-12-11 22:38:51 -06:00
parent fce1bf9de4
commit bf8397ba23
6 changed files with 201 additions and 0 deletions

View file

@ -1,5 +1,7 @@
# -*- coding: utf-8; -*-
import datetime
from unittest import TestCase
from unittest.mock import patch
import colander
@ -13,6 +15,22 @@ from wuttaweb.forms import widgets
from tests.util import DataTestCase, WebTestCase
class TestWutaDateTime(TestCase):
def test_deserialize(self):
typ = mod.WuttaDateTime()
node = colander.SchemaNode(typ)
result = typ.deserialize(node, colander.null)
self.assertIs(result, colander.null)
result = typ.deserialize(node, '2024-12-11T10:33 PM')
self.assertIsInstance(result, datetime.datetime)
self.assertEqual(result, datetime.datetime(2024, 12, 11, 22, 33))
self.assertRaises(colander.Invalid, typ.deserialize, node, 'bogus')
class TestObjectNode(DataTestCase):
def setUp(self):