Esempio n. 1
0
 def test_address_combined(self):
     """Test AddressFilter with complex filters."""
     af1 = AddressFilter("2-/2,3,5-/*")
     self.assertTrue(af1.match("2/3/8"))
     self.assertTrue(af1.match("4/7/10"))
     self.assertTrue(af1.match("2/7/10"))
     self.assertFalse(af1.match("1/7/10"))
     self.assertFalse(af1.match("2/4/10"))
     self.assertFalse(af1.match("2/1/10"))
Esempio n. 2
0
 def test_address_combined(self):
     """Test AddressFilter with complex filters."""
     af1 = AddressFilter("2-/2,3,5-/*")
     self.assertTrue(af1.match("2/3/8"))
     self.assertTrue(af1.match("4/7/10"))
     self.assertTrue(af1.match("2/7/10"))
     self.assertFalse(af1.match("1/7/10"))
     self.assertFalse(af1.match("2/4/10"))
     self.assertFalse(af1.match("2/1/10"))
Esempio n. 3
0
 def test_address_filter_level3_2(self):
     """Test AddressFilter 2nd part of level3 addresses."""
     af1 = AddressFilter("1/2/3")
     self.assertTrue(af1.match("1/2/3"))
     self.assertFalse(af1.match("1/3/3"))
     self.assertFalse(af1.match("1/1/3"))
     af2 = AddressFilter("1/2-/3")
     self.assertFalse(af2.match("1/1/3"))
     self.assertTrue(af2.match("1/2/3"))
     self.assertTrue(af2.match("1/5/3"))
     af3 = AddressFilter("1/*/3")
     self.assertTrue(af3.match("1/4/3"))
     self.assertTrue(af3.match("1/7/3"))
Esempio n. 4
0
 def test_address_filter_level3_2(self):
     """Test AddressFilter 2nd part of level3 addresses."""
     af1 = AddressFilter("1/2/3")
     self.assertTrue(af1.match("1/2/3"))
     self.assertFalse(af1.match("1/3/3"))
     self.assertFalse(af1.match("1/1/3"))
     af2 = AddressFilter("1/2-/3")
     self.assertFalse(af2.match("1/1/3"))
     self.assertTrue(af2.match("1/2/3"))
     self.assertTrue(af2.match("1/5/3"))
     af3 = AddressFilter("1/*/3")
     self.assertTrue(af3.match("1/4/3"))
     self.assertTrue(af3.match("1/7/3"))
Esempio n. 5
0
 def test_address_filter_free(self):
     """Test AddressFilter free format addresses."""
     af1 = AddressFilter("4")
     self.assertTrue(af1.match("4"))
     self.assertFalse(af1.match("1"))
     self.assertFalse(af1.match("10"))
     af2 = AddressFilter("1,4,7-")
     self.assertTrue(af2.match("1"))
     self.assertFalse(af2.match("2"))
     self.assertTrue(af2.match("4"))
     self.assertFalse(af2.match("6"))
     self.assertTrue(af2.match("60"))
     af3 = AddressFilter("*")
     self.assertTrue(af3.match("2"))
     self.assertTrue(af3.match("8"))
Esempio n. 6
0
 def test_address_filter_free(self):
     """Test AddressFilter free format addresses."""
     af1 = AddressFilter("4")
     self.assertTrue(af1.match("4"))
     self.assertFalse(af1.match("1"))
     self.assertFalse(af1.match("10"))
     af2 = AddressFilter("1,4,7-")
     self.assertTrue(af2.match("1"))
     self.assertFalse(af2.match("2"))
     self.assertTrue(af2.match("4"))
     self.assertFalse(af2.match("6"))
     self.assertTrue(af2.match("60"))
     af3 = AddressFilter("*")
     self.assertTrue(af3.match("2"))
     self.assertTrue(af3.match("8"))
Esempio n. 7
0
 def test_address_filter_level2_1(self):
     """Test AddressFilter 1st part of level2 addresses."""
     af1 = AddressFilter("4/2")
     self.assertTrue(af1.match("4/2"))
     self.assertFalse(af1.match("2/2"))
     self.assertFalse(af1.match("10/2"))
     af2 = AddressFilter("2-3,8-/4")
     self.assertFalse(af2.match("1/4"))
     self.assertTrue(af2.match("2/4"))
     self.assertFalse(af2.match("7/4"))
     self.assertTrue(af2.match("10/4"))
     af3 = AddressFilter("*/5")
     self.assertTrue(af3.match("2/5"))
     self.assertTrue(af3.match("8/5"))
Esempio n. 8
0
 def test_address_filter_level2_1(self):
     """Test AddressFilter 1st part of level2 addresses."""
     af1 = AddressFilter("4/2")
     self.assertTrue(af1.match("4/2"))
     self.assertFalse(af1.match("2/2"))
     self.assertFalse(af1.match("10/2"))
     af2 = AddressFilter("2-3,8-/4")
     self.assertFalse(af2.match("1/4"))
     self.assertTrue(af2.match("2/4"))
     self.assertFalse(af2.match("7/4"))
     self.assertTrue(af2.match("10/4"))
     af3 = AddressFilter("*/5")
     self.assertTrue(af3.match("2/5"))
     self.assertTrue(af3.match("8/5"))
Esempio n. 9
0
 def test_address_filter_level2_2(self):
     """Test AddressFilter 2nd part of level2 addresses."""
     af1 = AddressFilter("2/3")
     self.assertTrue(af1.match("2/3"))
     self.assertFalse(af1.match("2/4"))
     self.assertFalse(af1.match("2/1"))
     af2 = AddressFilter("2/3-4,7-")
     self.assertFalse(af2.match("2/2"))
     self.assertTrue(af2.match("2/3"))
     self.assertFalse(af2.match("2/6"))
     self.assertTrue(af2.match("2/8"))
     af3 = AddressFilter("2/*")
     self.assertTrue(af3.match("2/3"))
     self.assertTrue(af3.match("2/5"))
Esempio n. 10
0
 def test_address_filter_level3_3(self):
     """Test AddressFilter 3rd part of level3 addresses."""
     af1 = AddressFilter("1/2/3")
     self.assertTrue(af1.match("1/2/3"))
     self.assertFalse(af1.match("1/2/4"))
     self.assertFalse(af1.match("1/2/1"))
     af2 = AddressFilter("1/2/2-3,5-")
     self.assertFalse(af2.match("1/2/1"))
     self.assertTrue(af2.match("1/2/3"))
     self.assertFalse(af2.match("1/2/4"))
     self.assertTrue(af2.match("1/2/6"))
     af3 = AddressFilter("1/2/*")
     self.assertTrue(af3.match("1/2/3"))
     self.assertTrue(af3.match("1/2/5"))
Esempio n. 11
0
 def test_address_filter_level2_2(self):
     """Test AddressFilter 2nd part of level2 addresses."""
     af1 = AddressFilter("2/3")
     self.assertTrue(af1.match("2/3"))
     self.assertFalse(af1.match("2/4"))
     self.assertFalse(af1.match("2/1"))
     af2 = AddressFilter("2/3-4,7-")
     self.assertFalse(af2.match("2/2"))
     self.assertTrue(af2.match("2/3"))
     self.assertFalse(af2.match("2/6"))
     self.assertTrue(af2.match("2/8"))
     af3 = AddressFilter("2/*")
     self.assertTrue(af3.match("2/3"))
     self.assertTrue(af3.match("2/5"))
Esempio n. 12
0
 def test_address_filter_level3_3(self):
     """Test AddressFilter 3rd part of level3 addresses."""
     af1 = AddressFilter("1/2/3")
     self.assertTrue(af1.match("1/2/3"))
     self.assertFalse(af1.match("1/2/4"))
     self.assertFalse(af1.match("1/2/1"))
     af2 = AddressFilter("1/2/2-3,5-")
     self.assertFalse(af2.match("1/2/1"))
     self.assertTrue(af2.match("1/2/3"))
     self.assertFalse(af2.match("1/2/4"))
     self.assertTrue(af2.match("1/2/6"))
     af3 = AddressFilter("1/2/*")
     self.assertTrue(af3.match("1/2/3"))
     self.assertTrue(af3.match("1/2/5"))