From 086c7986557ab90c54f548f56f723e2940f055c1 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 17 Feb 2020 09:41:59 -0500 Subject: [PATCH] Further refine fractional seconds datetimeoffset fixture in 55f6d61e85b7f16df0b77f1c55a4fb051cd696e3 we still forgot to accommodate for Python 3 timezone constructor rejecting fractional minutes so the test further needs lambdas to prevent the constructor from invoking for Python versions less than 3.7 Change-Id: I02a83888f5ffbbe53ed0ce16c46a70942add4a3c (cherry picked from commit a8b4ea8819e08c0eaa74b53385a91c22916401c7) --- test/dialect/mssql/test_types.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/test/dialect/mssql/test_types.py b/test/dialect/mssql/test_types.py index 1f0ae0a6fa..92d3d9e327 100644 --- a/test/dialect/mssql/test_types.py +++ b/test/dialect/mssql/test_types.py @@ -749,10 +749,10 @@ class TypeRoundTripTest( return t @testing.combinations( - ("dto_param_none", None, None, False), + ("dto_param_none", lambda: None, None, False), ( "dto_param_datetime_aware_positive", - datetime.datetime( + lambda: datetime.datetime( 2007, 10, 30, @@ -767,7 +767,7 @@ class TypeRoundTripTest( ), ( "dto_param_datetime_aware_negative", - datetime.datetime( + lambda: datetime.datetime( 2007, 10, 30, @@ -782,7 +782,7 @@ class TypeRoundTripTest( ), ( "dto_param_datetime_aware_seconds_frac_fail", - datetime.datetime( + lambda: datetime.datetime( 2007, 10, 30, @@ -798,19 +798,24 @@ class TypeRoundTripTest( ), ( "dto_param_datetime_naive", - datetime.datetime(2007, 10, 30, 11, 2, 32, 123456), + lambda: datetime.datetime(2007, 10, 30, 11, 2, 32, 123456), 0, False, ), ( "dto_param_string_one", - "2007-10-30 11:02:32.123456 +01:00", + lambda: "2007-10-30 11:02:32.123456 +01:00", 1, False, ), # wow - ("dto_param_string_two", "October 30, 2007 11:02:32.123456", 0, False), - ("dto_param_string_invalid", "this is not a date", 0, True), + ( + "dto_param_string_two", + lambda: "October 30, 2007 11:02:32.123456", + 0, + False, + ), + ("dto_param_string_invalid", lambda: "this is not a date", 0, True), id_="iaaa", argnames="dto_param_value, expected_offset_hours, should_fail", ) @@ -822,6 +827,8 @@ class TypeRoundTripTest( should_fail, ): t = datetimeoffset_fixture + dto_param_value = dto_param_value() + with testing.db.begin() as conn: if should_fail: assert_raises( -- 2.47.2