Skip to content

Commit

Permalink
do not use as_str, as_bytes in tests
Browse files Browse the repository at this point in the history
they might remain usefull is users call this library with wrong parameters type
  • Loading branch information
a-detiste committed Aug 10, 2024
1 parent b7ef0a1 commit 6e3d1b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
17 changes: 0 additions & 17 deletions vertica_python/tests/common/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import getpass
from configparser import ConfigParser

from ...compat import as_str, as_bytes
from ...vertica.log import VerticaLogging


Expand Down Expand Up @@ -128,22 +127,6 @@ def tearDown(self):
self.logger.info('\n'+'-'*10+' End '+self.__class__.__name__+"."+self._testMethodName+' '+'-'*10+'\n')

# Common assertions
def assertStrEqual(self, first, second, msg=None):
first_str = as_str(first)
second_str = as_str(second)
self.assertEqual(first=first_str, second=second_str, msg=msg)

def assertBytesEqual(self, first, second, msg=None):
first_bytes = as_bytes(first)
second_bytes = as_bytes(second)
self.assertEqual(first=first_bytes, second=second_bytes, msg=msg)

def assertResultEqual(self, value, result, msg=None):
if isinstance(value, str):
self.assertStrEqual(first=value, second=result, msg=msg)
else:
self.assertEqual(first=value, second=result, msg=msg)

def assertListOfListsEqual(self, list1, list2, msg=None):
self.assertEqual(len(list1), len(list2), msg=msg)
for l1, l2 in zip(list1, list2):
Expand Down
12 changes: 6 additions & 6 deletions vertica_python/tests/integration_tests/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_unicode_query(self):
cur.execute(query)
res = cur.fetchone()

self.assertResultEqual(value, res[0])
self.assertEqual(value, res[0])

def test_unicode_list_parameter(self):
values = ['\u00f1', 'foo', 3]
Expand All @@ -60,7 +60,7 @@ def test_unicode_list_parameter(self):
results = cur.fetchone()

for val, res in zip(values, results):
self.assertResultEqual(val, res)
self.assertEqual(val, res)

def test_unicode_named_parameter_binding(self):
values = ['\u16b1', 'foo', 3]
Expand All @@ -74,7 +74,7 @@ def test_unicode_named_parameter_binding(self):
results = cur.fetchone()

for val, res in zip(values, results):
self.assertResultEqual(val, res)
self.assertEqual(val, res)

def test_string_query(self):
value = 'test'
Expand All @@ -97,7 +97,7 @@ def test_string_named_parameter_binding(self):
cur.execute(query, {key: value})
res = cur.fetchone()

self.assertResultEqual(value, res[0])
self.assertEqual(value, res[0])

# unit test for issue #160
def test_null_named_parameter_binding(self):
Expand All @@ -110,7 +110,7 @@ def test_null_named_parameter_binding(self):
cur.execute(query, {key: value})
res = cur.fetchone()

self.assertResultEqual(value, res[0])
self.assertEqual(value, res[0])

# unit test for issue #160
def test_null_list_parameter(self):
Expand All @@ -123,4 +123,4 @@ def test_null_list_parameter(self):
results = cur.fetchone()

for val, res in zip(values, results):
self.assertResultEqual(val, res)
self.assertEqual(val, res)

0 comments on commit 6e3d1b4

Please sign in to comment.