def test_range_test(self): """Test matching within AddressFilter.Range.""" rf = AddressFilter.Range("2-16") self.assertTrue(rf.match(10)) self.assertTrue(rf.match(2)) self.assertTrue(rf.match(16)) self.assertFalse(rf.match(1)) self.assertFalse(rf.match(17))
def test_range_initialization(self): """Test Initialization of AddresFilter.Range.""" self.assertEqual(AddressFilter.Range("*").get_range(), (0, 65535)) self.assertEqual(AddressFilter.Range("5").get_range(), (5, 5)) self.assertEqual(AddressFilter.Range("0").get_range(), (0, 0)) self.assertEqual(AddressFilter.Range("3-5").get_range(), (3, 5)) self.assertEqual(AddressFilter.Range("5-3").get_range(), (3, 5)) self.assertEqual(AddressFilter.Range("-5").get_range(), (0, 5)) self.assertEqual(AddressFilter.Range("5-").get_range(), (5, 65535)) self.assertEqual(AddressFilter.Range("70-100").get_range(), (70, 100))