def test_new_mark(): """ Test kwarg """ configuration = '\n'.join([ 'FLAGS:', ' short: No', ' pad: Yes', '', 'TEST:', ' pref: TEST', ' pref_s: t', ' pref_color: y', ' pref_bgcol: blue', ' pref_gloss: 1', ' text_color: k', ' text_bgcol: 7', ' text_gloss: d', '', ]) with tempfile.NamedTemporaryFile('wt', delete=False) as config: config.write(configuration) DEFAULT_PRINT.set_opts() DEFAULT_PRINT.set_opts(Path(config.name)) DEFAULT_PRINT.psprint("Test Text", mark='TEST') DEFAULT_PRINT.psprint("Info Test", mark='info') config.close() DEFAULT_PRINT.remove_style(mark='TEST')
def test_bad_conf(self): ''' bad configuration mark ''' configuration = '\n'.join([ 'FLAGS:', ' short: No', ' pad: Yes', '', 'TEST:', 'levle:', ' pref: TEST', ' pref_s: t', ' pref_color: y', ' pref_bgcol: blue', ' pref_gloss: 1', ' text_color: k', ' text_bgcol: 7', ' text_gloss: d', '', ]) with tempfile.NamedTemporaryFile('wt', delete=False) as config: config.write(configuration) self.assertRaises(errors.BadMark, lambda: DEFAULT_PRINT.set_opts(Path(config.name)))