Exemple #1
0
    def test_over_max(self):
        values = []
        for n in xrange(5):
            values.append({'value': 'frame %d' % n})
        value = {'values': values}
        trim_exceptions(value, max_values=4)

        assert len(value['values']) == 4

        for value, num in zip(values[:2], xrange(2)):
            assert value['value'] == 'frame %d' % num

        for value, num in zip(values[2:], xrange(3, 5)):
            assert value['value'] == 'frame %d' % num
    def test_over_max(self):
        values = []
        for n in xrange(5):
            values.append({"value": "frame %d" % n})
        value = {"values": values}
        trim_exceptions(value, max_values=4)

        assert len(value["values"]) == 4

        for value, num in zip(values[:2], xrange(2)):
            assert value["value"] == "frame %d" % num

        for value, num in zip(values[2:], xrange(3, 5)):
            assert value["value"] == "frame %d" % num
Exemple #3
0
    def test_over_max(self):
        values = []
        for n in xrange(5):
            values.append({'value': 'frame %d' % n})
        value = {'values': values}
        trim_exceptions(value, max_values=4)

        assert len(value['values']) == 4

        for value, num in zip(values[:2], xrange(2)):
            assert value['value'] == 'frame %d' % num

        for value, num in zip(values[2:], xrange(3, 5)):
            assert value['value'] == 'frame %d' % num
Exemple #4
0
 def test_under_max(self):
     value = {'values': [{'value': 'foo'}]}
     trim_exceptions(value)
     assert len(value['values']) == 1
     assert value.get('exc_omitted') is None
 def test_under_max(self):
     value = {"values": [{"value": "foo"}]}
     trim_exceptions(value)
     assert len(value["values"]) == 1
     assert value.get("exc_omitted") is None
Exemple #6
0
 def test_under_max(self):
     value = {'values': [{'value': 'foo'}]}
     trim_exceptions(value)
     assert len(value['values']) == 1
     assert value.get('exc_omitted') is None