Skip to content

Commit

Permalink
owcsvimport: Add test_browse_for_missing_prefixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed Sep 4, 2020
1 parent b70ed6d commit 5636879
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Orange/widgets/data/tests/test_owcsvimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,34 @@ def test_browse_for_missing(self):
self.data_regions_options.as_dict(), cur.options().as_dict()
)

def test_browse_for_missing_prefixed(self):
path = self.data_regions_path
basedir = os.path.dirname(path)
widget = self.create_widget(
owcsvimport.OWCSVFileImport, stored_settings={
"__version__": 3,
"_session_items_v2": [
(PathItem.VarPath("basedir", "this file does not exist.csv").as_dict(),
self.data_regions_options.as_dict())]
},
env={"basedir": basedir}
)
widget.activate_recent(0)
dlg = widget.findChild(QFileDialog)
assert dlg is not None
# calling selectFile when using native (macOS) dialog does not have
# an effect - at least not immediately;
dlg.setOption(QFileDialog.DontUseNativeDialog)
dlg.selectFile(path)
dlg.accept()
cur = widget.current_item()
self.assertTrue(samepath(path, cur.path()))
self.assertEqual(
cur.varPath(), PathItem.VarPath("basedir", "data-regions.tab"))
self.assertEqual(
self.data_regions_options.as_dict(), cur.options().as_dict()
)


class TestImportDialog(GuiTest):
@staticmethod
Expand Down

0 comments on commit 5636879

Please sign in to comment.