def _test_css_file(self, filename): inf = os.path.join(TESTDATA, filename) outf = inf + ".out" with open(inf) as f: given = f.read() actual = isolcss("#X", given) if os.environ.get("UPDATE_TEST_OUTPUT"): with open(outf, "w") as f: f.write(actual) with open(outf) as f: expected = f.read() self.assertEqual(actual, expected)
def test_replace(self): given = "p, .class > &.x[name=foo] { rules; }" expected = "#X p, .class > #X.x[name=foo] { rules; }" actual = isolcss("#X", given) self.assertEqual(actual, expected)
def test_simple(self): given = "p, .class > x[name=foo] { rules; }" expected = "#X p, #X .class > x[name=foo] { rules; }" actual = isolcss("#X", given) self.assertEqual(actual, expected)