Beispiel #1
0
    def test_get_limit(self):
        """
        Tests the static get limit method which should return the limit on the amount of elements that should be shown/returned
        """
        test_cases = {
            None: 0,
            '': 0,
            '0': 0,
            '5': 5,
            '-5': 0,
            '1.5': 0,
            '-1.5': 0,
            5: 5,
            -5: 0,
            1.5: 1,
            -1.5: 0,
        }

        unicode_test_cases = {
            '': 0,
            '0': 0,
            '5': 5,
            '-5': 0,
            '1.5': 0,
            '-1.5': 0,
        }

        for tests in test_cases, unicode_test_cases:
            for (action, result) in six.iteritems(tests):
                self.assertEqual(History._get_limit(action), result)  # pylint: disable=protected-access
Beispiel #2
0
    def test_get_limit(self):
        """
        Tests the static get limit method which should return the limit on the amount of elements that should be shown/returned
        """
        test_cases = {
            None: 0,
            "": 0,
            "0": 0,
            "5": 5,
            "-5": 0,
            "1.5": 0,
            "-1.5": 0,
            5: 5,
            -5: 0,
            1.5: 1,
            -1.5: 0,
        }

        unicode_test_cases = {
            "": 0,
            "0": 0,
            "5": 5,
            "-5": 0,
            "1.5": 0,
            "-1.5": 0,
        }

        for tests in test_cases, unicode_test_cases:
            for (action, result) in tests.items():
                assert History._get_limit(action) == result