本文整理汇总了Python中Orange.widgets.data.owsave.OWSave.get_writers方法的典型用法代码示例。如果您正苦于以下问题:Python OWSave.get_writers方法的具体用法?Python OWSave.get_writers怎么用?Python OWSave.get_writers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.widgets.data.owsave.OWSave
的用法示例。
在下文中一共展示了OWSave.get_writers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_filename_with_fix_extension
# 需要导入模块: from Orange.widgets.data.owsave import OWSave [as 别名]
# 或者: from Orange.widgets.data.owsave.OWSave import get_writers [as 别名]
def test_filename_with_fix_extension(self):
def mock_fix_choice(ret):
f = lambda *x: ret
f.__dict__.update(fix_extension.__dict__)
return f
change_filter = iter([PickleReader, TabReader])
for file_choice, fix in [
[lambda *x: ("o.pickle", format_filter(TabReader)),
mock_fix_choice(fix_extension.CHANGE_EXT)],
[lambda *x: ("o.tab", format_filter(PickleReader)),
mock_fix_choice(fix_extension.CHANGE_FORMAT)],
[lambda *x: ("o.tab", format_filter(next(change_filter))),
mock_fix_choice(fix_extension.CANCEL)]
]:
with patch("AnyQt.QtWidgets.QFileDialog.getSaveFileName", file_choice),\
patch("Orange.widgets.utils.filedialogs.fix_extension", fix):
saved_filename, format, filter = \
open_filename_dialog_save(".", None, OWSave.get_writers(False))
self.assertEqual(saved_filename, "o.tab")
self.assertEqual(format, TabReader)
self.assertEqual(filter, format_filter(TabReader))