From 55f86ecb40646e1b1fcff28eff3396349757c659 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rajmund=20Hru=C5=A1ka?= <rajmund.hruska@gmail.com>
Date: Thu, 28 Nov 2024 13:27:00 +0100
Subject: [PATCH] Test equality with arbitrary objects
---
test_ipranges.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/test_ipranges.py b/test_ipranges.py
index 8ad0955..ef9b29e 100755
--- a/test_ipranges.py
+++ b/test_ipranges.py
@@ -108,6 +108,14 @@ class TestIPRange(unittest.TestCase):
self.assertFalse(ip2 != ip3)
self.assertFalse(ip1 != ip3)
+ def test4OtherObject(self):
+ ip1 = IP4Net("192.0.2.65/32")
+ ip2 = IP4Range("192.0.2.65-192.0.2.65")
+ ip3 = IP4("192.0.2.65")
+ self.assertFalse(ip1 == [ip1])
+ self.assertFalse(ip2 == 1)
+ self.assertFalse(ip3 == "192.0.2.65")
+
def test6SameNetRange(self):
net1 = IP6Net("2001:db8:220:1::/64")
net2 = IP6Range("2001:db8:220:1::-2001:db8:220:1:ffff:ffff:ffff:ffff")
@@ -125,6 +133,14 @@ class TestIPRange(unittest.TestCase):
self.assertFalse(ip2 != ip3)
self.assertFalse(ip1 != ip3)
+ def test6OtherObject(self):
+ ip1 = IP6Net("2001:db8:220:1:248:1893:25c8:1946/128")
+ ip2 = IP6Range("2001:db8:220:1:248:1893:25c8:1946-2001:db8:220:1:248:1893:25c8:1946")
+ ip3 = IP6("2001:db8:220:1:248:1893:25c8:1946")
+ self.assertFalse(ip1 == [ip1])
+ self.assertFalse(ip2 == 1)
+ self.assertFalse(ip3 == "2001:db8:220:1:248:1893:25c8:1946")
+
def test4Contains(self):
self.assertTrue(IP4Net("192.0.2.64/28") in IP4Net("192.0.2.64/26"))
self.assertTrue(IP4Net("192.0.2.64/28") in IP4Range("192.0.2.64-192.0.2.127"))
--
GitLab