Exemplo n.º 1
0
    def test_get_limit(self):
        """
        Test get limit
        """
        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 = {
            u'': 0,
            u'0': 0,
            u'5': 5,
            u'-5': 0,
            u'1.5': 0,
            u'-1.5': 0,
        }

        for tests in test_cases, unicode_test_cases:
            for (action, result) in tests.iteritems():
                self.assertEqual(History._get_limit(action), result)  # pylint: disable=protected-access
Exemplo n.º 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 six.iteritems(tests):
                self.assertEqual(History._get_limit(action), result)  # pylint: disable=protected-access
Exemplo n.º 3
0
    def test_get_limit(self):
        """
        Test get limit
        """
        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 = {
            u'': 0,
            u'0': 0,
            u'5': 5,
            u'-5': 0,
            u'1.5': 0,
            u'-1.5': 0,
        }

        for tests in test_cases, unicode_test_cases:
            for (action, result) in tests.iteritems():
                self.assertEqual(History._get_limit(action), result)  # pylint: disable=protected-access
Exemplo n.º 4
0
    def test_get_limit(self):
        tests = {
            None: 0,
            '': 0,
            u'': 0,
            '0': 0,
            u'0': 0,
            '5': 5,
            u'5': 5,
            '-5': 0,
            u'-5': 0,
            '1.5': 0,
            u'1.5': 0,
            '-1.5': 0,
            u'-1.5': 0,
            5: 5,
            -5: 0,
            1.5: 1,
            -1.5: 0,
        }

        for (action, result) in tests.iteritems():
            self.assertEqual(History._get_limit(action), result)
Exemplo n.º 5
0
    def test_get_limit(self):
        tests = {
            None: 0,
            '': 0,
            u'': 0,
            '0': 0,
            u'0': 0,
            '5': 5,
            u'5': 5,
            '-5': 0,
            u'-5': 0,
            '1.5': 0,
            u'1.5': 0,
            '-1.5': 0,
            u'-1.5': 0,
            5: 5,
            -5: 0,
            1.5: 1,
            -1.5: 0,
        }

        for (action, result) in tests.iteritems():
            self.assertEqual(History._get_limit(action), result)