1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
From: Carsten Schoenert <c.schoenert@t-online.de>
Date: Sun, 27 Nov 2022 11:06:34 +0100
Subject: tests: Adding a hack to handle list element
test_supports_custom_datetime_format does some checking about formated
datetime elements which seems now to be a list of one or more elements.
This patch isn't a real fixing, yes.
---
tests/test_configuration.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/test_configuration.py b/tests/test_configuration.py
index 5e697e9..8069659 100644
--- a/tests/test_configuration.py
+++ b/tests/test_configuration.py
@@ -2,6 +2,8 @@ import sqlalchemy as sa
from pytest import raises
from wtforms.fields import IntegerField
from wtforms.validators import Email
+from packaging.version import Version
+import wtforms
from tests import ModelFormTestCase, MultiDict
from wtforms_alchemy import (
@@ -151,7 +153,11 @@ class TestModelFormConfiguration(ModelFormTestCase):
datetime_format = '%Y-%m-%dT%H:%M:%S'
form = ModelTestForm()
- assert form.test_column.format == '%Y-%m-%dT%H:%M:%S'
+ # Ugly hack, yeah. wtforms 3.x seems to return a list.
+ if Version(wtforms.__version__) < Version('3'):
+ assert form.test_column.format == '%Y-%m-%dT%H:%M:%S'
+ else:
+ assert form.test_column.format == ['%Y-%m-%dT%H:%M:%S']
def test_supports_additional_validators(self):
self.init()
|