File: test_compress.py

package info (click to toggle)
python-csscompressor 0.9.4-2~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 700 kB
  • sloc: python: 1,764; makefile: 36
file content (54 lines) | stat: -rw-r--r-- 1,360 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
##
# Copyright (c) 2013 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##


from csscompressor.tests.base import BaseTest
from csscompressor import compress

import unittest


class Tests(unittest.TestCase):
    def test_linelen_1(self):
        input = '''
            a {content: '}}'}
            b {content: '}'}
            c {content: '{'}
        '''
        output = compress(input, max_linelen=2)
        assert output == "a{content:'}}'}\nb{content:'}'}\nc{content:'{'}"

    def test_linelen_2(self):
        input = ''
        output = compress(input, max_linelen=2)
        assert output == ""

    def test_linelen_3(self):
        input = '''
            a {content: '}}'}
            b {content: '}'}
            c {content: '{'}
            d {content: '{'}
        '''
        output = compress(input, max_linelen=100)
        assert output == "a{content:'}}'}b{content:'}'}c{content:'{'}\nd{content:'{'}"

    def test_compress_1(self):
        input = '''
            a {content: '}}'} /*
            b {content: '}'}
            c {content: '{'}
            d {content: '{'}
        '''
        output = compress(input)
        assert output == "a{content:'}}'}"

    def test_compress_2(self):
        input = '''
            a {content: calc(10px-10%}
        '''
        self.assertRaises(ValueError, compress, input)