def test_out_of_bounds_negative_index_should_raise(self): i = IPRange(IP('10.0.42.0'), IP('10.0.42.127')) with pytest.raises(IndexError): i[-129]
def test_ipv6_range_length_should_be_correct(self): i = IPRange(IP('fe80:700:1::'), IP('fe80:700:1::f')) assert len(i) == 16
def test_indexed_access_should_work(self): i = IPRange(IP('10.0.42.0'), IP('10.0.42.127')) assert i[5] == IP('10.0.42.5')
def test_ipv4_range_length_should_be_correct(self): i = IPRange(IP('10.0.42.0'), IP('10.0.42.127')) assert len(i) == 128
def test_out_of_bounds_negative_index_should_raise(self): i = IPRange(IP('10.0.42.0'), IP('10.0.42.127')) self.assertRaises(IndexError, lambda x: i[x], -129)
def test_indexed_access_should_work(self): i = IPRange(IP('10.0.42.0'), IP('10.0.42.127')) self.assertEquals(i[5], IP('10.0.42.5'))
def test_ipv6_range_length_should_be_correct(self): i = IPRange(IP('fe80:700:1::'), IP('fe80:700:1::f')) self.assertEquals(len(i), 16)
def test_ipv4_range_length_should_be_correct(self): i = IPRange(IP('10.0.42.0'), IP('10.0.42.127')) self.assertEquals(len(i), 128)