mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-10-18 01:24:18 +03:00
test: adapt to interface representations in different Python versions
Is 3.12.10 (or lower) being used by the runner? Fix version ranges Condition expected value based on observed Python behaviour Co-authored-by: Daniele Varrazzo <daniele.varrazzo@gmail.com>
This commit is contained in:
parent
e0507a891c
commit
236c52b712
|
@ -71,10 +71,13 @@ class NetworkingTestCase(testutils.ConnectingTestCase):
|
|||
cur.execute("select %s", [ip.ip_interface('::ffff:102:300/128')])
|
||||
|
||||
# The texual representation of addresses has changed in Python 3.13
|
||||
if sys.version_info >= (3, 13):
|
||||
# https://github.com/python/cpython/issues/128840
|
||||
if str(ip.ip_interface("::ffff:102:300/128")) == "::ffff:1.2.3.0/128":
|
||||
self.assertEquals(cur.fetchone()[0], '::ffff:1.2.3.0/128')
|
||||
else:
|
||||
elif str(ip.ip_interface("::ffff:102:300/128")) == "::ffff:102:300/128":
|
||||
self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
|
||||
else:
|
||||
assert False, "unexpected"
|
||||
|
||||
@testutils.skip_if_crdb("cidr")
|
||||
def test_cidr_cast(self):
|
||||
|
@ -117,10 +120,13 @@ class NetworkingTestCase(testutils.ConnectingTestCase):
|
|||
cur.execute("select %s", [ip.ip_network('::ffff:102:300/128')])
|
||||
|
||||
# The texual representation of addresses has changed in Python 3.13
|
||||
if sys.version_info >= (3, 13):
|
||||
# https://github.com/python/cpython/issues/128840
|
||||
if str(ip.ip_interface("::ffff:102:300/128")) == "::ffff:1.2.3.0/128":
|
||||
self.assertEquals(cur.fetchone()[0], '::ffff:1.2.3.0/128')
|
||||
else:
|
||||
elif str(ip.ip_interface("::ffff:102:300/128")) == "::ffff:102:300/128":
|
||||
self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
|
||||
else:
|
||||
assert False, "unexpected"
|
||||
|
||||
|
||||
def test_suite():
|
||||
|
|
Loading…
Reference in New Issue
Block a user