File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313import ipaddress
1414import weakref
1515from test .support import LARGEST , SMALLEST
16+ from typing import Iterator
1617
1718
1819class 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 ])
You can’t perform that action at this time.
0 commit comments