def test_write_verify_css_text(self): css_directory = unittest_file_path(folder='test_css') file_name = 'blowdry' css_file = CSSFile(file_directory=css_directory, file_name=file_name) file_path = path.join(css_directory, css_file.file_name + '.css') if path.isfile(file_path): # Ensure that file is deleted before testing. remove(file_path) css_text = b'.bold {\n font-weight: bold\n }\n.margin-top-50px {\n margin-top: 50px\n }\n' \ b'.c-blue {\n color: blue\n }\n.height-50px {\n height: 50px\n }\n' \ b'.bgc-h000 {\n background-color: #000\n }\n.color-hfff {\n color: #fff\n }\n' \ b'.valign-middle {\n vertical-align: middle\n }\n.height-150px {\n height: 150px\n }\n' \ b'.text-align-center {\n text-align: center\n }' expected_string = css_text.decode('utf-8') css_file.write(css_text=css_text) with open(file_path, 'r') as css_file: file_string = css_file.read() self.assertEqual(file_string, expected_string)