def test_level_filter(self):
        mock_record = MockURLTableRecord()
        mock_record.level = 4
        url_filter = LevelFilter(0)
        self.assertTrue(url_filter.test(None, mock_record))

        url_filter = LevelFilter(5)
        mock_record.level = 5
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.level = 6
        self.assertFalse(url_filter.test(None, mock_record))

        mock_record.inline = True
        self.assertTrue(url_filter.test(None, mock_record))
    def test_level_filter(self):
        mock_record = MockURLTableRecord()
        mock_record.level = 4
        url_filter = LevelFilter(0)
        self.assertTrue(url_filter.test(None, mock_record))

        url_filter = LevelFilter(5)
        mock_record.level = 5
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.level = 6
        self.assertFalse(url_filter.test(None, mock_record))

        mock_record.inline = True
        self.assertTrue(url_filter.test(None, mock_record))
Exemple #3
0
    def test_level_filter(self):
        mock_record = MockURLTableRecord()
        mock_record.level = 4
        url_filter = LevelFilter(0)
        self.assertTrue(url_filter.test(None, mock_record))

        url_filter = LevelFilter(5)
        mock_record.level = 5
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.level = 6
        self.assertFalse(url_filter.test(None, mock_record))

        url_filter = LevelFilter(5)
        mock_record.inline = 1
        mock_record.level = 5
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.level = 6
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.level = 7
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.level = 8
        self.assertFalse(url_filter.test(None, mock_record))

        url_filter = LevelFilter(0)
        mock_record.inline = 1
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.inline = 2
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.inline = 3
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.inline = 4
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.inline = 5
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.inline = 6
        self.assertFalse(url_filter.test(None, mock_record))

        mock_record.level = 1

        url_filter = LevelFilter(0, inline_max_depth=0)
        mock_record.inline = 1000
        self.assertTrue(url_filter.test(None, mock_record))

        url_filter = LevelFilter(5, inline_max_depth=1)
        mock_record.inline = 1
        self.assertTrue(url_filter.test(None, mock_record))
        mock_record.inline = 2
        self.assertFalse(url_filter.test(None, mock_record))
Exemple #4
0
    def test_level_filter(self):
        record = URLRecord()
        record.level = 4
        url_filter = LevelFilter(0)
        self.assertTrue(url_filter.test(None, record))

        url_filter = LevelFilter(5)
        record.level = 5
        self.assertTrue(url_filter.test(None, record))
        record.level = 6
        self.assertFalse(url_filter.test(None, record))

        url_filter = LevelFilter(5)
        record.inline_level = 1
        record.level = 5
        self.assertTrue(url_filter.test(None, record))
        record.level = 6
        self.assertTrue(url_filter.test(None, record))
        record.level = 7
        self.assertTrue(url_filter.test(None, record))
        record.level = 8
        self.assertFalse(url_filter.test(None, record))

        url_filter = LevelFilter(0)
        record.inline_level = 1
        self.assertTrue(url_filter.test(None, record))
        record.inline_level = 2
        self.assertTrue(url_filter.test(None, record))
        record.inline_level = 3
        self.assertTrue(url_filter.test(None, record))
        record.inline_level = 4
        self.assertTrue(url_filter.test(None, record))
        record.inline_level = 5
        self.assertTrue(url_filter.test(None, record))
        record.inline_level = 6
        self.assertFalse(url_filter.test(None, record))

        record.level = 1

        url_filter = LevelFilter(0, inline_max_depth=0)
        record.inline_level = 1000
        self.assertTrue(url_filter.test(None, record))

        url_filter = LevelFilter(5, inline_max_depth=1)
        record.inline_level = 1
        self.assertTrue(url_filter.test(None, record))
        record.inline_level = 2
        self.assertFalse(url_filter.test(None, record))