Skip to content

Commit 6591779

Browse files
committed
Fix: unittest failing due to BIGINT UNSIGNED VALUE
A unittest was failing due to the conversion of a BIGINT unsigned giving as result an OperationalError: BIGINT UNSIGNED value is out of range in '(1997 - year(curdate())) The test was corrected to generate the valid value.
1 parent 6aa9bcf commit 6591779

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_mysqlx_crud.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,12 +1431,12 @@ def test_modify_patch(self):
14311431
result = collection.modify('TRUE').patch(
14321432
{"actors_bio": {"current": {
14331433
"age": mysqlx.expr(
1434-
'CAST(SUBSTRING_INDEX($.actors_bio.bd, " ", 1)'
1435-
' AS DECIMAL) - Year(CURDATE())')}}
1434+
'CAST(Year(CURDATE()) - '
1435+
'SUBSTRING_INDEX($.actors_bio.bd, " ", 1) AS DECIMAL)')}}
14361436
}).execute()
14371437
self.assertEqual(8, result.get_affected_items_count())
1438-
res = self.session.sql("select 1997 - Year(CURDATE())").execute()
1439-
age = res.fetch_all()[0]["1997 - Year(CURDATE())"]
1438+
res = self.session.sql("select Year(CURDATE()) - 1997").execute()
1439+
age = res.fetch_all()[0]["Year(CURDATE()) - 1997"]
14401440
doc = collection.find(
14411441
"actors_bio.rn = 'Maisie Williams'").execute().fetch_all()[0]
14421442
self.assertEqual(

0 commit comments

Comments
 (0)