def effective_opts_dict(d): """ Given a configuration dictionary, returns the effective HTML-Tidy options dictionary (default, from file, or custom). """ k = d[consts.tidy_opts_config_category] if k == consts.default_tidy_opts_config: return tidy_opt_utils.names_dicts_to_dict( tidy_opt_utils.default_names_dicts() ) elif k == consts.from_file_tidy_opts_config: return tidy_opt_utils.read_dict( d[consts.opt_file_name_category] ) elif k == consts.custom_tidy_opts_config: return tidy_opt_utils.names_dicts_to_dict( d[consts.custom_opts_names_dicts_category] ) else: assert False
def _default_config_dict(): """ Returns a configuration dictionary with the default choices. Used when can't open a file describing these choices. """ d = {} d[consts.tidy_opts_config_category] = consts.default_tidy_opts_config d[consts.type_config_category] = consts.mime_type_config d[consts.type_ext_category] = consts.html_xhtml_and_xml_exts d[consts.opt_file_name_category] = consts.opt_file_name d[consts.custom_opts_names_dicts_category] = tidy_opt_utils.default_names_dicts() return d
def test_notebook_0(self): self._test_notebook(tidy_opt_utils.default_names_dicts(), True)
def test_defaults_dlg(self): tabs = tidy_opt_utils.default_names_dicts() o = dlg(None, tabs, False) rep = o.run()
def test_tidy_the_stuff_0(self): opts_dict = tidy_opt_utils.names_dicts_to_dict(tidy_opt_utils.default_names_dicts()) (d, tidy_reports) = tidy_the_stuff('', opts_dict) self.assert_(len(tidy_reports) != 0)