From c9b17d4a2a02a63b563084bce99aa041cbeabb1d Mon Sep 17 00:00:00 2001
From: Scott Kitterman <scott@kitterman.com>
Date: Tue, 2 Jan 2024 12:45:01 -0500
Subject: [PATCH 1/3] Update test_idna_encoding_query_a with new errno to align
 to new c-ares version

---
 tests/test_all.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/test_all.py b/tests/test_all.py
index 41aefc4..4f569cd 100755
--- a/tests/test_all.py
+++ b/tests/test_all.py
@@ -569,7 +569,7 @@ def cb(result, errorno):
         # try encoding it as utf-8
         self.channel.query(host.encode(), pycares.QUERY_TYPE_A, cb)
         self.wait()
-        self.assertEqual(self.errorno, pycares.errno.ARES_ENOTFOUND)
+        self.assertEqual(self.errorno, pycares.errno.ARES_EBADNAME)
         self.assertEqual(self.result, None)
         # use it as is (it's IDNA encoded internally)
         self.channel.query(host, pycares.QUERY_TYPE_A, cb)

From b3f06e1e5e30e1a6acbf3d2111bbe12ac9dfbf9c Mon Sep 17 00:00:00 2001
From: Scott Kitterman <scott@kitterman.com>
Date: Tue, 2 Jan 2024 13:58:23 -0500
Subject: [PATCH 2/3] Accept either ARES_ETIMEOUT or ARES_EBADNAME for
 compatibility with c-ares 1.16 and 1.24

---
 tests/test_all.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/test_all.py b/tests/test_all.py
index 4f569cd..961aa4d 100755
--- a/tests/test_all.py
+++ b/tests/test_all.py
@@ -569,6 +569,9 @@ def cb(result, errorno):
         # try encoding it as utf-8
         self.channel.query(host.encode(), pycares.QUERY_TYPE_A, cb)
         self.wait()
+        # ARES_EBADNAME correct for c-ares 1.24 and ARES_ETIMEOUT for 1.18
+        if self.errorno == pycares.errno.ARES_ETIMEOUT:
+            self.errorno = pycares.errno.ARES_EBADNAME
         self.assertEqual(self.errorno, pycares.errno.ARES_EBADNAME)
         self.assertEqual(self.result, None)
         # use it as is (it's IDNA encoded internally)

From f68a63a49f096b20d7ed66f828f7337635510ec2 Mon Sep 17 00:00:00 2001
From: Scott Kitterman <scott@kitterman.com>
Date: Tue, 2 Jan 2024 14:03:30 -0500
Subject: [PATCH 3/3] Correct errno for 1.18

---
 tests/test_all.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/test_all.py b/tests/test_all.py
index 961aa4d..dd00323 100755
--- a/tests/test_all.py
+++ b/tests/test_all.py
@@ -569,8 +569,8 @@ def cb(result, errorno):
         # try encoding it as utf-8
         self.channel.query(host.encode(), pycares.QUERY_TYPE_A, cb)
         self.wait()
-        # ARES_EBADNAME correct for c-ares 1.24 and ARES_ETIMEOUT for 1.18
-        if self.errorno == pycares.errno.ARES_ETIMEOUT:
+        # ARES_EBADNAME correct for c-ares 1.24 and ARES_ENOTFOUND for 1.18
+        if self.errorno == pycares.errno.ARES_ENOTFOUND:
             self.errorno = pycares.errno.ARES_EBADNAME
         self.assertEqual(self.errorno, pycares.errno.ARES_EBADNAME)
         self.assertEqual(self.result, None)