Skip to content

Commit

Permalink
fix sqlite tests on certain Python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend committed Jun 13, 2024
1 parent 68dfeb3 commit 9bc8f93
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/columns/test_get_sql_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,27 @@ def test_time(self):

@engines_only("sqlite")
class TestArraySQLite(TestCase):
"""
Note, we use ``.replace(" ", "")`` because we serialise arrays using
Python's json library, and there is inconsistency between Python versions
(some output ``["a", "b", "c"]``, and others ``["a","b","c"]``).
"""

def test_string(self):
self.assertEqual(
Band.name.get_sql_value(["a", "b", "c"]),
Band.name.get_sql_value(["a", "b", "c"]).replace(" ", ""),
'\'["a","b","c"]\'',
)

def test_int(self):
self.assertEqual(
Band.name.get_sql_value([1, 2, 3]),
Band.name.get_sql_value([1, 2, 3]).replace(" ", ""),
"'[1,2,3]'",
)

def test_nested(self):
self.assertEqual(
Band.name.get_sql_value([1, 2, 3, [4, 5, 6]]),
Band.name.get_sql_value([1, 2, 3, [4, 5, 6]]).replace(" ", ""),
"'[1,2,3,[4,5,6]]'",
)

Expand Down

0 comments on commit 9bc8f93

Please sign in to comment.