src/eric7/Testing/TestResultsTree.py

branch
eric7-maintenance
changeset 9549
67295777d9fe
parent 9442
906485dcd210
parent 9502
6091145e189e
child 9654
7328efba128b
--- a/src/eric7/Testing/TestResultsTree.py	Mon Oct 31 14:07:57 2022 +0100
+++ b/src/eric7/Testing/TestResultsTree.py	Wed Nov 30 09:19:51 2022 +0100
@@ -16,21 +16,20 @@
 from operator import attrgetter
 
 from PyQt6.QtCore import (
-    pyqtSignal,
-    pyqtSlot,
-    Qt,
     QAbstractItemModel,
     QCoreApplication,
     QModelIndex,
     QPoint,
+    Qt,
+    pyqtSignal,
+    pyqtSlot,
 )
 from PyQt6.QtGui import QBrush, QColor
 from PyQt6.QtWidgets import QMenu, QTreeView
 
+from eric7 import Preferences
 from eric7.EricWidgets.EricApplication import ericApp
 
-from eric7 import Preferences
-
 from .Interfaces.TestExecutorBase import TestResultCategory
 
 TopLevelId = 2**32 - 1
@@ -147,24 +146,27 @@
                     if duration is None
                     else locale.format_string("%.2f", duration, grouping=True)
                 )
-        elif role == Qt.ItemDataRole.ToolTipRole:
-            if idx == TopLevelId and column == TestResultsModel.NameColumn:
-                return self.__testResults[row].name
-        elif role == Qt.ItemDataRole.FontRole:
-            if idx != TopLevelId:
-                return Preferences.getEditorOtherFonts("MonospacedFont")
-        elif role == Qt.ItemDataRole.BackgroundRole:
-            if idx == TopLevelId:
-                testResult = self.__testResults[row]
-                with contextlib.suppress(KeyError):
-                    return self.__backgroundColors[testResult.category]
-        elif role == Qt.ItemDataRole.TextAlignmentRole:
-            if idx == TopLevelId and column == TestResultsModel.DurationColumn:
-                return Qt.AlignmentFlag.AlignRight.value
-        elif role == Qt.ItemDataRole.UserRole:  # __IGNORE_WARNING_Y102__
-            if idx == TopLevelId:
-                testresult = self.__testResults[row]
-                return (testresult.filename, testresult.lineno)
+        elif (
+            role == Qt.ItemDataRole.ToolTipRole
+            and idx == TopLevelId
+            and column == TestResultsModel.NameColumn
+        ):
+            return self.__testResults[row].name
+        elif role == Qt.ItemDataRole.FontRole and idx != TopLevelId:
+            return Preferences.getEditorOtherFonts("MonospacedFont")
+        elif role == Qt.ItemDataRole.BackgroundRole and idx == TopLevelId:
+            testResult = self.__testResults[row]
+            with contextlib.suppress(KeyError):
+                return self.__backgroundColors[testResult.category]
+        elif (
+            role == Qt.ItemDataRole.TextAlignmentRole
+            and idx == TopLevelId
+            and column == TestResultsModel.DurationColumn
+        ):
+            return Qt.AlignmentFlag.AlignRight.value
+        elif role == Qt.ItemDataRole.UserRole and idx == TopLevelId:
+            testresult = self.__testResults[row]
+            return (testresult.filename, testresult.lineno)
 
         return None
 

eric ide

mercurial