def test_exact_ip(self): ipr1 = IPRange(ip_from='127.0.0.1') self.assertTrue(ipr1.in_range('127.0.0.1')) self.assertFalse(ipr1.in_range('127.0.0.0')) self.assertFalse(ipr1.in_range('127.0.0.2')) self.assertFalse(ipr1.in_range('255.255.255.255'))
def test_100_to_end(self): ipr1 = IPRange(ip_from='100.1.1.1', ip_to='255.255.255.255') self.assertTrue(ipr1.in_range('127.0.0.1'))
def test_all_the_range(self): ipr1 = IPRange(ip_from='0.0.0.0', ip_to='255.255.255.255') self.assertTrue(ipr1.in_range('127.0.0.1'))