Error logging and mutables as function defaults (#930)

* Remove mutable iterables as function defaults
* Improve error reporting and standardise how it's done
This commit is contained in:
Veronica Berglyd Olsen
2021-11-10 00:32:01 +01:00
committed by GitHub
parent 67d2e266fd
commit 00eea24e3f
15 changed files with 88 additions and 65 deletions
+3 -3
View File
@@ -56,7 +56,7 @@ def testCoreDocument_LoadSave(monkeypatch, mockGUI, nwMinimal):
mp.setattr("builtins.open", causeOSError)
theDoc = NWDoc(theProject, sHandle)
assert theDoc.readDocument() is None
assert theDoc.getError() == "OSError"
assert theDoc.getError() == "OSError: Mock OSError"
# Load the text
theDoc = NWDoc(theProject, sHandle)
@@ -107,7 +107,7 @@ def testCoreDocument_LoadSave(monkeypatch, mockGUI, nwMinimal):
with monkeypatch.context() as mp:
mp.setattr("builtins.open", causeOSError)
assert theDoc.writeDocument(theText) is False
assert theDoc.getError() == "OSError"
assert theDoc.getError() == "OSError: Mock OSError"
# Saving with no handle
theDoc._docHandle = None
@@ -126,7 +126,7 @@ def testCoreDocument_LoadSave(monkeypatch, mockGUI, nwMinimal):
mp.setattr("os.unlink", causeOSError)
theDoc = NWDoc(theProject, xHandle)
assert theDoc.deleteDocument() is False
assert theDoc.getError() == "OSError"
assert theDoc.getError() == "OSError: Mock OSError"
# Make the delete pass
theDoc = NWDoc(theProject, xHandle)