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_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_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 = 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 )