コード例 #1
0
    def test_matches_include_partial(self):
        t = PrefixCoverTree()
        t.exclude('/assets/favicon.ico')
        t.include('/assets/')

        matches = set(t.matches())
        self.assertEqual(matches, {('/assets/', True)})
コード例 #2
0
    def test_matches_include_none(self):
        t = PrefixCoverTree()
        t.exclude('/index.html')
        t.exclude('/assets/image1.png')
        t.exclude('/assets/image2.png')

        matches = set(t.matches())
        self.assertEqual(matches, set())
コード例 #3
0
    def test_matches_only_include(self):
        t = PrefixCoverTree()
        t.include('/index.html')
        t.include('/assets/image1.png')
        t.include('/assets/image2.png')

        matches = set(t.matches())
        self.assertEqual(matches, {('', False)})
コード例 #4
0
    def test_matches_include_none(self):
        t = PrefixCoverTree()
        t.exclude('/index.html')
        t.exclude('/assets/image1.png')
        t.exclude('/assets/image2.png')

        matches = set(t.matches())
        self.assertEqual(matches, set())
コード例 #5
0
    def test_matches_include_partial(self):
        t = PrefixCoverTree()
        t.exclude('/assets/favicon.ico')
        t.include('/assets/')

        matches = set(t.matches())
        self.assertEqual(matches, {
            ('/assets/', True)
        })
コード例 #6
0
    def test_matches_only_include(self):
        t = PrefixCoverTree()
        t.include('/index.html')
        t.include('/assets/image1.png')
        t.include('/assets/image2.png')

        matches = set(t.matches())
        self.assertEqual(matches, {
            ('', False)
        })
コード例 #7
0
    def test_matches(self):
        t = PrefixCoverTree()
        t.include('/index.html')

        t.exclude('/assets/favicon.ico')
        t.exclude('/assets/image1.png')

        t.include('/assets/image2.png')
        t.include('/content/page1.html')
        t.include('/content/page2.html')
        t.include('/content/page3.html')
        t.include('/css/main.css')

        matches = set(t.matches())
        self.assertEqual(matches, {('/index.html', True),
                                   ('/assets/image2.png', True),
                                   ('/c', False)})
コード例 #8
0
    def test_matches(self):
        t = PrefixCoverTree()
        t.include('/index.html')

        t.exclude('/assets/favicon.ico')
        t.exclude('/assets/image1.png')

        t.include('/assets/image2.png')
        t.include('/content/page1.html')
        t.include('/content/page2.html')
        t.include('/content/page3.html')
        t.include('/css/main.css')

        matches = set(t.matches())
        self.assertEqual(matches, {
            ('/index.html', True),
            ('/assets/image2.png', True),
            ('/c', False)
        })
コード例 #9
0
 def test_include_then_exclude(self):
     t = PrefixCoverTree()
     t.include('/index.html')
     t.exclude('/index.html')
     self.assertEqual(list(t), ['/index.html'])
     self.assertEqual(set(t.matches()), set())
コード例 #10
0
 def test_include_twice(self):
     t = PrefixCoverTree()
     t.include('/index.html')
     t.include('/index.html')
     self.assertEqual(list(t), ['/index.html'])
     self.assertEqual(set(t.matches()), {('', False)})
コード例 #11
0
 def test_matches_empty(self):
     t = PrefixCoverTree()
     matches = set(t.matches())
     self.assertEqual(matches, set())
コード例 #12
0
 def test_matches_empty(self):
     t = PrefixCoverTree()
     matches = set(t.matches())
     self.assertEqual(matches, set())
コード例 #13
0
 def test_include_then_exclude(self):
     t = PrefixCoverTree()
     t.include('/index.html')
     t.exclude('/index.html')
     self.assertEqual(list(t), ['/index.html'])
     self.assertEqual(set(t.matches()), set())
コード例 #14
0
 def test_include_twice(self):
     t = PrefixCoverTree()
     t.include('/index.html')
     t.include('/index.html')
     self.assertEqual(list(t), ['/index.html'])
     self.assertEqual(set(t.matches()), {('', False)})