Exemple #1
0
 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]
Exemple #2
0
 def test_ipv6_range_length_should_be_correct(self):
     i = IPRange(IP('fe80:700:1::'), IP('fe80:700:1::f'))
     assert len(i) == 16
Exemple #3
0
 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')
Exemple #4
0
 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
Exemple #5
0
 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)
Exemple #6
0
 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'))
Exemple #7
0
 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)
Exemple #8
0
 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)