def test_input_output_files(self): """ isass -o out.css file1 """ Popen([self.cmd,'-o',self.output_file, self.input_file]).wait() with open(self.output_file) as of: o = of.read() expected_result=''' body { background-color: #EEE; } ''' self.assertEqual(purifylines(expected_result), purifylines(o))
def test_import(self): in_sass = """ @import colors.sass """ out_css = isass.get_css(in_sass,lib_dirs=self.lib_dirs) out_lines = purifylines(out_css) test_css = """ body { background-color: #EEE; } """ test_lines = purifylines(test_css) self.assertEqual(out_lines, test_lines)
def test_indent(self): in_sass = """ a font: family: Helvetica """ out_css = isass.get_scss(in_sass) out_lines = purifylines(out_css) test_css = """ a { font: { family: Helvetica; } } """ test_lines = purifylines(test_css) self.assertEqual(out_lines, test_lines)
def test_lib_dirs(self): """ isass -l . file1 """ p = Popen([self.cmd, '--lib-dir', self.thisdir, self.index_sass_file],stdout=PIPE) ret_code = p.wait() self.assertEqual(ret_code,0) if ret_code == 0: o = p.stdout.read() expected_result='''body { background-color: #EEE; } #divroot { color: #22598e; }''' self.assertEqual(purifylines(expected_result), purifylines(o))
def test_comment(self): in_sass = """ /* comment body /* comment background-color: white """ out_css = isass.get_scss(in_sass) out_lines = purifylines(out_css) test_css = """ /* comment */ body { /* comment */ background-color: white; } """ test_lines = purifylines(test_css) self.assertEqual(out_lines, test_lines)
def test_std_in_out(self): """ isass < file.sass """ # feed standard input with open(self.input_file) as input_file: p = Popen([self.cmd], stdin=input_file, stdout=PIPE) ret_code = p.wait() self.assertEqual(ret_code,0) if ret_code == 0: o = p.stdout.read() expected_result=''' body { background-color: #EEE; } ''' self.assertEqual(purifylines(expected_result), purifylines(o))
def test_scss(self): """ isass --scss file1 """ p = Popen([self.cmd,'--scss', self.input_file],stdout=PIPE) ret_code = p.wait() self.assertEqual(ret_code,0) if ret_code == 0: o = p.stdout.read() expected_result=''' /* http://colorschemedesigner.com/#3.61Eqarrxnho */ $link-color : #333333; $back-color: #333333; $primary-color: #22598e; body { background-color: #EEE; }''' self.assertEqual(purifylines(expected_result), purifylines(o))
def test_line_continuation(self): in_sass = """ #container, #article_container, #sidebar_container, #footer_container, #useless_container background-color: #DDD """ out_css = isass.get_css(in_sass) out_lines = purifylines(out_css) self.assertTrue(len(out_lines) > 0 )
def testCompileString(self): sass = """ @import colors.sass .page-footer .copy-right, .page-footer .bottom display: block width:100% float: left color: $link-color """ res = isass.get_css(sass,lib_dirs=self.lib_dirs) self.assertTrue(len(purifylines(res)) > 0)