Example #1
0
    def test_call(self, testobj, data):
        """ Test the __call__ method for each test record and blacklist option.

        """
        filter, blacklist = testobj
        expect = data if data["accept"] is not blacklist else None
        assert expect == filter(data)
        return
Example #2
0
    def test_call(self, testobj, data):
        """ Test the __call__ method for each test record and blacklist option.

        """
        filter, blacklist = testobj
        expect = data if data["accept"] is not blacklist else None
        assert expect == filter(data)
        return
Example #3
0
    def test_call(self, testobj, data):
        """ Test the __call__ method for each test string and blacklist option.

        """
        filter, blacklist = testobj
        text = data["text"]
        expect = text if data["accept"] is not blacklist else None
        assert expect == filter(text)
        return
Example #4
0
    def test_call(self, testobj, data):
        """ Test the __call__ method for each test string and blacklist option.

        """
        filter, blacklist = testobj
        text = data["text"]
        expect = text if data["accept"] is not blacklist else None
        assert expect == filter(text)
        return
Example #5
0
    def test_call_missing(self, testobj, data):
        """ Test the __call__ method for each test record and blacklist option.

        """
        filter, blacklist = testobj
        data = data.copy()  # record is NOT test-independent
        del data["value"]
        expect = data if blacklist else None
        assert expect == filter(data)
        return
Example #6
0
    def test_call_missing(self, testobj, data):
        """ Test the __call__ method for each test record and blacklist option.

        """
        filter, blacklist = testobj
        data = data.copy()  # record is NOT test-independent
        del data["value"]
        expect = data if blacklist else None
        assert expect == filter(data)
        return
Example #7
0
    def test_call_limits(self, data, start, stop):
        """ Test the __call__() method with default limits.

        """
        filter = RangeFilter("value", start, stop)
        if start is None:
            expect = data if data["value"] < stop else None
        elif stop is None:
            expect = data if start <= data["value"] else None
        else:
            assert False  # shouldn't get here
        assert expect == filter(data)
        return
Example #8
0
    def test_call_limits(self, data, start, stop):
        """ Test the __call__() method with default limits.

        """
        filter = RangeFilter("value", start, stop)
        if start is None:
            expect = data if data["value"] < stop else None
        elif stop is None:
            expect = data if start <= data["value"] else None
        else:
            assert False  # shouldn't get here
        assert expect == filter(data)
        return