handle tuple returns from file dialog properly
This commit is contained in:
@@ -283,10 +283,10 @@ def testWritingStatsExport(qtbot, monkeypatch, yesToAll, nwFuncTemp, nwTemp):
|
||||
assert isinstance(sessLog, GuiWritingStats)
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
monkeypatch.setattr(QFileDialog, "getSaveFileName", lambda *args, **kwargs: [])
|
||||
monkeypatch.setattr(QFileDialog, "getSaveFileName", lambda *args, **kwargs: ("", ""))
|
||||
assert not sessLog._saveData(sessLog.FMT_CSV)
|
||||
|
||||
monkeypatch.setattr(QFileDialog, "getSaveFileName", lambda ss, tt, pp, options: [pp])
|
||||
monkeypatch.setattr(QFileDialog, "getSaveFileName", lambda ss, tt, pp, options: (pp, ""))
|
||||
assert sessLog._saveData(sessLog.FMT_CSV)
|
||||
qtbot.wait(stepDelay)
|
||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||
|
||||
+3
-3
@@ -1107,16 +1107,16 @@ def testInsertMenu(qtbot, monkeypatch, nwFuncTemp, nwTemp):
|
||||
nwGUI.closeDocument()
|
||||
|
||||
# First, with no path
|
||||
monkeypatch.setattr(QFileDialog, "getOpenFileName", lambda *args, **kwards: [])
|
||||
monkeypatch.setattr(QFileDialog, "getOpenFileName", lambda *args, **kwards: ("", ""))
|
||||
assert not nwGUI.importDocument()
|
||||
|
||||
# Then with a path, but an invalid one
|
||||
monkeypatch.setattr(QFileDialog, "getOpenFileName", lambda *args, **kwards: [" "])
|
||||
monkeypatch.setattr(QFileDialog, "getOpenFileName", lambda *args, **kwards: (" ", ""))
|
||||
assert not nwGUI.importDocument()
|
||||
|
||||
# Then a valid path, but bot a file that exists
|
||||
theFile = os.path.join(nwTemp, "import.txt")
|
||||
monkeypatch.setattr(QFileDialog, "getOpenFileName", lambda *args, **kwards: [theFile])
|
||||
monkeypatch.setattr(QFileDialog, "getOpenFileName", lambda *args, **kwards: (theFile, ""))
|
||||
assert not nwGUI.importDocument()
|
||||
|
||||
# Create the file and try again, but with no target document open
|
||||
|
||||
Reference in New Issue
Block a user