Skip to content
Snippets Groups Projects
Commit e498f9c7 authored by Joseph Torsney's avatar Joseph Torsney
Browse files

Change RuntimeError to EOFError re28176

parent 09aacf47
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ from qtpy.QtWidgets import QInputDialog ...@@ -11,7 +11,7 @@ from qtpy.QtWidgets import QInputDialog
def input_qinputdialog(prompt: str = "") -> str: def input_qinputdialog(prompt: str = "") -> str:
""" """
Raises a QInputDialog with a given prompt and returns the user input as a string. Raises a QInputDialog with a given prompt and returns the user input as a string.
If the user cancels the dialog, a RuntimeError is raised. If the user cancels the dialog, an EOFError is raised.
Intended to be used to override python's `input` function to be more user friendly. Intended to be used to override python's `input` function to be more user friendly.
""" """
dlg = QInputDialog() dlg = QInputDialog()
...@@ -21,4 +21,4 @@ def input_qinputdialog(prompt: str = "") -> str: ...@@ -21,4 +21,4 @@ def input_qinputdialog(prompt: str = "") -> str:
if accepted: if accepted:
return dlg.textValue() return dlg.textValue()
else: else:
raise RuntimeError("User input request cancelled") raise EOFError("User input request cancelled")
...@@ -39,4 +39,4 @@ class IOTest(TestCase): ...@@ -39,4 +39,4 @@ class IOTest(TestCase):
mock_QInputDialog = mock_QInputDialogClass() mock_QInputDialog = mock_QInputDialogClass()
mock_QInputDialog.exec_.return_value = False mock_QInputDialog.exec_.return_value = False
self.assertRaises(RuntimeError, input_qinputdialog) self.assertRaises(EOFError, input_qinputdialog)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment