Ejemplo n.º 1
0
def test_compile_source():
    compiler = SCSS(executable="scss")
    assert fix_line_breaks(compiler.compile_source("p {font-size: 15px; a {color: red;}}")) == "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n"

    compiler = SCSS(executable="sass")
    assert fix_line_breaks(compiler.compile_source("p {font-size: 15px; a {color: red;}}")) == "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n"

    with pytest.raises(StaticCompilationError):
        compiler.compile_source('invalid syntax')

    with pytest.raises(StaticCompilationError):
        compiler.compile_source('invalid syntax')

    # Test non-ascii
    NON_ASCII = """@charset "UTF-8";
.external_link:first-child:before {
  content: "Zobacz także:";
  background: url(картинка.png); }
"""
    assert fix_line_breaks(compiler.compile_source(NON_ASCII)) == NON_ASCII

    compiler = SASS(executable="sass")
    assert fix_line_breaks(compiler.compile_source("p\n  font-size: 15px\n  a\n    color: red")) == "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n"
    compiler = SASS(executable="scss")
    assert fix_line_breaks(compiler.compile_source("p\n  font-size: 15px\n  a\n    color: red")) == "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n"
Ejemplo n.º 2
0
def test_compile_source():
    compiler = SCSS(executable="scss")
    assert (fix_line_breaks(
        compiler.compile_source("p {font-size: 15px; a {color: red;}}")) ==
            "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n")

    compiler = SCSS(executable="sass")
    assert (fix_line_breaks(
        compiler.compile_source("p {font-size: 15px; a {color: red;}}")) ==
            "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n")

    with pytest.raises(StaticCompilationError):
        compiler.compile_source('invalid syntax')

    with pytest.raises(StaticCompilationError):
        compiler.compile_source('invalid syntax')

    # Test non-ascii
    NON_ASCII = """@charset "UTF-8";
.external_link:first-child:before {
  content: "Zobacz także:";
  background: url(картинка.png); }
"""
    assert fix_line_breaks(compiler.compile_source(NON_ASCII)) == NON_ASCII

    compiler = SASS(executable="sass")
    assert (fix_line_breaks(
        compiler.compile_source("p\n  font-size: 15px\n  a\n    color: red"))
            == "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n")
    compiler = SASS(executable="scss")
    assert (fix_line_breaks(
        compiler.compile_source("p\n  font-size: 15px\n  a\n    color: red"))
            == "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n")
    def test_compass(self):
        compiler = SCSS()

        self.assertEqual(
            fix_line_breaks(compiler.compile_file("test-compass.scss")),
            "p {\n  background: url('/static/images/test.png'); }\n"
        )
Ejemplo n.º 4
0
def test_compile_source():
    compiler = compilers.Stylus()

    assert utils.fix_line_breaks(compiler.compile_source("p\n  color: red;")) == "p {\n  color: #f00;\n}\n\n"

    with pytest.raises(exceptions.StaticCompilationError):
        assert compiler.compile_source("broken")
def test_compile_source():
    compiler = compilers.Stylus()

    assert utils.fix_line_breaks(compiler.compile_source("p\n  color: red;")) == "p {\n  color: #f00;\n}\n\n"

    with pytest.raises(exceptions.StaticCompilationError):
        assert compiler.compile_source("broken")
def test_compass():
    compiler = SCSS(compass_enabled=True)

    assert (
        fix_line_breaks(compiler.compile_file("test-compass.scss")) ==
        "p {\n  background: url('/static/images/test.png'); }\n"
    )
    def test_compile_file(self):
        compiler = SASS()

        self.assertEqual(
            fix_line_breaks(compiler.compile_file("styles/test.sass")),
            "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n"
        )
def test_compile_file():
    compiler = SCSS()

    assert (
        fix_line_breaks(compiler.compile_file("styles/test.scss")) ==
        "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n"
    )
def test_compile_file():
    compiler = Stylus()

    assert fix_line_breaks(compiler.compile_file("styles/stylus/A.styl")) == "p {\n  color: #f00;\n}\n"

    with pytest.raises(StaticCompilationError):
        assert compiler.compile_file("styles/stylus/broken1.styl")
Ejemplo n.º 10
0
def test_compass_import():
    compiler = SCSS(compass_enabled=True)

    assert fix_line_breaks(compiler.compile_file("styles/test-compass-import.scss")) == ".round-corners {\n  -moz-border-radius: 4px / 4px;\n  -webkit-border-radius: 4px 4px;\n  border-radius: 4px / 4px; }\n"

    compiler = SCSS(compass_enabled=False)
    with pytest.raises(StaticCompilationError):
        compiler.compile_file("styles/test-compass-import.scss")
Ejemplo n.º 11
0
def test_compile_file():
    compiler = Stylus()

    assert fix_line_breaks(compiler.compile_file(
        "styles/stylus/A.styl")) == "p {\n  color: #f00;\n}\n"

    with pytest.raises(StaticCompilationError):
        assert compiler.compile_file("styles/stylus/broken1.styl")
Ejemplo n.º 12
0
    def test_compile_source(self):
        compiler = SASS()

        self.assertEqual(
            fix_line_breaks(compiler.compile_source("p\n  font-size: 15px")),
            "p {\n  font-size: 15px; }\n")

        self.assertRaises(StaticCompilationError,
                          lambda: compiler.compile_source('invalid syntax'))
    def test_compass_import(self):
        compiler = SCSS()

        with patch.object(compiler, "compass_enabled", return_value=True):
            self.assertEqual(
                fix_line_breaks(compiler.compile_file("styles/test-compass-import.scss")),
                ".round-corners {\n  -webkit-border-radius: 4px 4px;\n  -moz-border-radius: 4px / 4px;\n  border-radius: 4px / 4px; }\n"
            )

        with patch.object(compiler, "compass_enabled", return_value=False):
            self.assertRaises(StaticCompilationError, lambda: compiler.compile_file("styles/test-compass-import.scss"))
Ejemplo n.º 14
0
    def test_compile_source(self):
        compiler = SCSS()

        self.assertEqual(
            fix_line_breaks(
                compiler.compile_source(
                    "p {font-size: 15px; a {color: red;}}")),
            "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n")

        self.assertRaises(StaticCompilationError,
                          lambda: compiler.compile_source('invalid syntax'))

        # Test non-ascii
        NON_ASCII = """@charset "UTF-8";
.external_link:first-child:before {
  content: "Zobacz także:";
  background: url(картинка.png); }
"""
        self.assertEqual(fix_line_breaks(compiler.compile_source(NON_ASCII)),
                         NON_ASCII)
    def test_compile_source(self):
        compiler = SASS()

        self.assertEqual(
            fix_line_breaks(compiler.compile_source("p\n  font-size: 15px")),
            "p {\n  font-size: 15px; }\n"
        )

        self.assertRaises(
            StaticCompilationError,
            lambda: compiler.compile_source('invalid syntax')
        )
Ejemplo n.º 16
0
def test_compass_import():
    compiler = SCSS(compass_enabled=True)

    assert (fix_line_breaks(
        compiler.compile_file("styles/test-compass-import.scss")) ==
            ".round-corners {\n"
            "  -moz-border-radius: 4px / 4px;\n"
            "  -webkit-border-radius: 4px 4px;\n"
            "  border-radius: 4px / 4px; }\n")

    compiler = SCSS(compass_enabled=False)
    with pytest.raises(StaticCompilationError):
        compiler.compile_file("styles/test-compass-import.scss")
    def test_compile_source(self):
        compiler = SCSS()

        self.assertEqual(
            fix_line_breaks(compiler.compile_source("p {font-size: 15px; a {color: red;}}")),
            "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n"
        )

        self.assertRaises(
            StaticCompilationError,
            lambda: compiler.compile_source('invalid syntax')
        )

        # Test non-ascii
        NON_ASCII = """@charset "UTF-8";
.external_link:first-child:before {
  content: "Zobacz także:";
  background: url(картинка.png); }
"""
        self.assertEqual(
            fix_line_breaks(compiler.compile_source(NON_ASCII)),
            NON_ASCII
        )
Ejemplo n.º 18
0
def test_compile_source(compiler_module):

    compiler = compiler_module.SCSS()
    assert (utils.fix_line_breaks(
        compiler.compile_source("p {font-size: 15px; a {color: red;}}")) ==
            "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n")

    with pytest.raises(exceptions.StaticCompilationError):
        compiler.compile_source('invalid syntax')

    # Test non-ascii
    NON_ASCII = """@charset "UTF-8";
.external_link:first-child:before {
  content: "Zobacz także:";
  background: url("картинка.png"); }
"""
    assert utils.fix_line_breaks(
        compiler.compile_source(NON_ASCII)) == NON_ASCII

    compiler = compiler_module.SASS()
    assert (utils.fix_line_breaks(
        compiler.compile_source("p\n  font-size: 15px\n  a\n    color: red"))
            == "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n")
def test_compile_source(compiler_module):

    compiler = compiler_module.SCSS()
    assert (
        utils.fix_line_breaks(compiler.compile_source("p {font-size: 15px; a {color: red;}}")) ==
        "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n"
    )

    with pytest.raises(exceptions.StaticCompilationError):
        compiler.compile_source('invalid syntax')

    # Test non-ascii
    NON_ASCII = """@charset "UTF-8";
.external_link:first-child:before {
  content: "Zobacz także:";
  background: url("картинка.png"); }
"""
    assert utils.fix_line_breaks(compiler.compile_source(NON_ASCII)) == NON_ASCII

    compiler = compiler_module.SASS()
    assert (
        utils.fix_line_breaks(compiler.compile_source("p\n  font-size: 15px\n  a\n    color: red")) ==
        "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n"
    )
Ejemplo n.º 20
0
def test_compile_file():
    compiler = SCSS()

    assert (fix_line_breaks(compiler.compile_file("styles/test.scss")) ==
            "p {\n  font-size: 15px; }\n  p a {\n    color: red; }\n")
Ejemplo n.º 21
0
def test_compass():
    compiler = SCSS(compass_enabled=True)

    assert (fix_line_breaks(compiler.compile_file("test-compass.scss")) ==
            "p {\n  background: url('/static/images/test.png'); }\n")