Skip to content

Commit dd8d1f2

Browse files
committed
tests
1 parent f7c1803 commit dd8d1f2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/test/test_ipaddress.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import ipaddress
1414
import weakref
1515
from test.support import LARGEST, SMALLEST
16+
from typing import Iterator
1617

1718

1819
class BaseTestCase(unittest.TestCase):
@@ -1472,12 +1473,16 @@ def testGetSupernet4(self):
14721473
self.ipv6_scoped_network.supernet(new_prefix=62))
14731474

14741475
def testHosts(self):
1476+
hosts = self.ipv4_network.hosts()
1477+
self.assertIsInstance(hosts, Iterator)
14751478
hosts = list(self.ipv4_network.hosts())
14761479
self.assertEqual(254, len(hosts))
14771480
self.assertEqual(ipaddress.IPv4Address('1.2.3.1'), hosts[0])
14781481
self.assertEqual(ipaddress.IPv4Address('1.2.3.254'), hosts[-1])
14791482

14801483
ipv6_network = ipaddress.IPv6Network('2001:658:22a:cafe::/120')
1484+
hosts = ipv6_network.hosts()
1485+
self.assertIsInstance(hosts, Iterator)
14811486
hosts = list(ipv6_network.hosts())
14821487
self.assertEqual(255, len(hosts))
14831488
self.assertEqual(ipaddress.IPv6Address('2001:658:22a:cafe::1'), hosts[0])

0 commit comments

Comments
 (0)