本文整理汇总了Python中Orange.widgets.data.owsave.OWSave.migrate_settings方法的典型用法代码示例。如果您正苦于以下问题:Python OWSave.migrate_settings方法的具体用法?Python OWSave.migrate_settings怎么用?Python OWSave.migrate_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.widgets.data.owsave.OWSave
的用法示例。
在下文中一共展示了OWSave.migrate_settings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_migration_to_version_2
# 需要导入模块: from Orange.widgets.data.owsave import OWSave [as 别名]
# 或者: from Orange.widgets.data.owsave.OWSave import migrate_settings [as 别名]
def test_migration_to_version_2(self):
const_settings = {
'add_type_annotations': True, 'auto_save': False,
'controlAreaVisible': True, 'last_dir': '/home/joe/Desktop',
'__version__': 1}
# No compression, Tab-separated values
settings = {**const_settings,
'compress': False, 'compression': 'gzip (.gz)',
'filetype': 'Tab-separated values (.tab)'}
OWSave.migrate_settings(settings)
self.assertEqual(
settings,
{**const_settings,
"filter": "Tab-separated values (*.tab)"})
# Compression; ignore compression format (.xz is no longer supported)
settings = {**const_settings,
'compress': True, 'compression': 'lzma (.xz)',
'filetype': 'Tab-separated values (.tab)'}
OWSave.migrate_settings(settings)
self.assertEqual(
settings,
{**const_settings,
"filter": "Compressed Tab-separated values (*.tab.gz)"})
# No compression, Excel
settings = {**const_settings,
'compress': False, 'compression': 'lzma (.xz)',
'filetype': 'Microsoft Excel spreadsheet (.xlsx)'}
OWSave.migrate_settings(settings)
self.assertEqual(
settings,
{**const_settings,
"filter": "Microsoft Excel spreadsheet (*.xlsx)"})
# Excel with compression - compression must be ignored
settings = {**const_settings,
'compress': True, 'compression': 'lzma (.xz)',
'filetype': 'Microsoft Excel spreadsheet (.xlsx)'}
OWSave.migrate_settings(settings)
self.assertEqual(
settings,
{**const_settings,
"filter": "Microsoft Excel spreadsheet (*.xlsx)"})
# Missing filetype (is this possible?)
settings = {**const_settings,
'compress': True, 'compression': 'lzma (.xz)'}
OWSave.migrate_settings(settings)
self.assertTrue(settings["filter"] in OWSave.filters)
# Unsupported file format (is this possible?)
settings = {**const_settings,
'compress': True, 'compression': 'lzma (.xz)',
'filetype': 'Bar file (.bar)'}
OWSave.migrate_settings(settings)
self.assertTrue(settings["filter"] in OWSave.filters)