aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-29 11:18:49 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-29 15:56:58 +0200
commit6d2af409eedee377b3c2ba0cd8156b9409fabd9d (patch)
tree660f8fd87f77c1030cf97cc65345b9a941a321e4
parent88fff87519e741a3a999b8c1545834d116859faa (diff)
Tests: Fix some space-related flake8 warnings
Change-Id: I9b0ad08839bf1246620c557ec304dfa90882907b Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py8
-rw-r--r--sources/pyside6/tests/QtCharts/qcharts_test.py18
-rw-r--r--sources/pyside6/tests/QtCore/blocking_signals_test.py22
-rw-r--r--sources/pyside6/tests/QtCore/bug_1019.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_1063.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_1069.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_1313.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_278_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_332.py7
-rw-r--r--sources/pyside6/tests/QtCore/bug_408.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_428.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_462.py16
-rw-r--r--sources/pyside6/tests/QtCore/bug_505.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_515.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_606.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_656.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_686.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_699.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_706.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_820.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_826.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_829.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_835.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_920.py2
-rw-r--r--sources/pyside6/tests/QtCore/bug_927.py20
-rw-r--r--sources/pyside6/tests/QtCore/bug_931.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_938.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_953.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_987.py1
-rw-r--r--sources/pyside6/tests/QtCore/bug_994.py4
-rw-r--r--sources/pyside6/tests/QtCore/bug_PYSIDE-164.py3
-rw-r--r--sources/pyside6/tests/QtCore/bug_PYSIDE-42.py1
-rw-r--r--sources/pyside6/tests/QtCore/child_event_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/classinfo_test.py21
-rw-r--r--sources/pyside6/tests/QtCore/deepcopy_test.py9
-rw-r--r--sources/pyside6/tests/QtCore/deletelater_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/destroysignal_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/duck_punching_test.py16
-rw-r--r--sources/pyside6/tests/QtCore/emoji_string_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/errormessages_with_features_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/hash_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/inherits_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/max_signals.py16
-rw-r--r--sources/pyside6/tests/QtCore/missing_symbols_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/mockclass_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/multiple_feature_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/python_conversion.py8
-rw-r--r--sources/pyside6/tests/QtCore/qabs_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qabstractitemmodel_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qanimationgroup_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qbitarray_test.py16
-rw-r--r--sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qbytearray_operator_test.py20
-rw-r--r--sources/pyside6/tests/QtCore/qbytearray_test.py10
-rw-r--r--sources/pyside6/tests/QtCore/qcalendar_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qcbor_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qcollator_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qcommandlineparser_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qcoreapplication_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qdatastream_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qdate_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qdatetime_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qeasingcurve_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qenum_test.py7
-rw-r--r--sources/pyside6/tests/QtCore/qevent_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qfile_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qfileinfo_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qfileread_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qflags_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qhandle_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qinstallmsghandler_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qlinef_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qlocale_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qlockfile_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qmetaobject_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qmimedatabase_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py19
-rw-r--r--sources/pyside6/tests/QtCore/qobject_children_segfault_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qobject_connect_notify_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qobject_destructor.py2
-rw-r--r--sources/pyside6/tests/QtCore/qobject_event_filter_test.py17
-rw-r--r--sources/pyside6/tests/QtCore/qobject_inherits_test.py17
-rw-r--r--sources/pyside6/tests/QtCore/qobject_objectproperty_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qobject_parent_test.py32
-rw-r--r--sources/pyside6/tests/QtCore/qobject_property_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qobject_protected_methods_test.py8
-rw-r--r--sources/pyside6/tests/QtCore/qobject_test.py12
-rw-r--r--sources/pyside6/tests/QtCore/qobject_timer_event_test.py9
-rw-r--r--sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qpoint_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/qprocess_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qproperty_decorator.py2
-rw-r--r--sources/pyside6/tests/QtCore/qrandomgenerator_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qrect_test.py17
-rw-r--r--sources/pyside6/tests/QtCore/qregularexpression_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/qresource_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qsettings_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qsize_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qslot_object_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qsrand_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qstandardpaths_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qstorageinfo_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qstring_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qsysinfo_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qtextstream_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qthread_prod_cons_test.py28
-rw-r--r--sources/pyside6/tests/QtCore/qthread_signal_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/qthread_test.py15
-rw-r--r--sources/pyside6/tests/QtCore/qtimer_singleshot_test.py8
-rw-r--r--sources/pyside6/tests/QtCore/qtimer_timeout_test.py9
-rw-r--r--sources/pyside6/tests/QtCore/qtimezone_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qtnamespace_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/qurl_test.py13
-rw-r--r--sources/pyside6/tests/QtCore/qurlquery_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/quuid_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qversionnumber_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/repr_test.py10
-rw-r--r--sources/pyside6/tests/QtCore/resources_mc.py3
-rw-r--r--sources/pyside6/tests/QtCore/setprop_on_ctor_test.py5
-rw-r--r--sources/pyside6/tests/QtCore/snake_prop_feature_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/staticMetaObject_test.py3
-rw-r--r--sources/pyside6/tests/QtCore/static_method_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/thread_signals_test.py10
-rw-r--r--sources/pyside6/tests/QtCore/tr_noop_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/translation_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/unaryoperator_test.py8
-rw-r--r--sources/pyside6/tests/QtCore/unicode_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/versioninfo_test.py1
-rw-r--r--sources/pyside6/tests/QtDataVisualization/datavisualization_test.py4
-rw-r--r--sources/pyside6/tests/QtGui/bug_1091.py1
-rw-r--r--sources/pyside6/tests/QtGui/bug_300_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_367.py5
-rw-r--r--sources/pyside6/tests/QtGui/bug_480.py2
-rw-r--r--sources/pyside6/tests/QtGui/bug_606.py2
-rw-r--r--sources/pyside6/tests/QtGui/bug_617.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_652.py2
-rw-r--r--sources/pyside6/tests/QtGui/bug_660.py15
-rw-r--r--sources/pyside6/tests/QtGui/bug_740.py4
-rw-r--r--sources/pyside6/tests/QtGui/bug_743.py6
-rw-r--r--sources/pyside6/tests/QtGui/bug_991.py2
-rw-r--r--sources/pyside6/tests/QtGui/bug_PYSIDE-344.py2
-rw-r--r--sources/pyside6/tests/QtGui/deepcopy_test.py13
-rw-r--r--sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py7
-rw-r--r--sources/pyside6/tests/QtGui/pyside_reload_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qcolor_reduce_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qcolor_test.py19
-rw-r--r--sources/pyside6/tests/QtGui/qcursor_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qdesktopservices_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qfontmetrics_test.py1
-rw-r--r--sources/pyside6/tests/QtGui/qguiapplication_test.py1
-rw-r--r--sources/pyside6/tests/QtGui/qicon_test.py1
-rw-r--r--sources/pyside6/tests/QtGui/qitemselection_test.py4
-rw-r--r--sources/pyside6/tests/QtGui/qkeysequence_test.py1
-rw-r--r--sources/pyside6/tests/QtGui/qpainter_test.py13
-rw-r--r--sources/pyside6/tests/QtGui/qpdfwriter_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qpixelformat_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qpixmap_test.py8
-rw-r--r--sources/pyside6/tests/QtGui/qpixmapcache_test.py1
-rw-r--r--sources/pyside6/tests/QtGui/qradialgradient_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qregion_test.py10
-rw-r--r--sources/pyside6/tests/QtGui/qstylehints_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py5
-rw-r--r--sources/pyside6/tests/QtGui/qtextline_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qtransform_test.py4
-rw-r--r--sources/pyside6/tests/QtGui/repr_test.py6
-rw-r--r--sources/pyside6/tests/QtGui/timed_app_and_patching_test.py4
-rw-r--r--sources/pyside6/tests/QtHelp/help_test.py2
-rw-r--r--sources/pyside6/tests/QtHelp/helpsearchengine_test.py2
-rw-r--r--sources/pyside6/tests/QtLocation/location.py1
-rw-r--r--sources/pyside6/tests/QtMultimedia/audio_test.py1
-rw-r--r--sources/pyside6/tests/QtMultimediaWidgets/qmultimediawidgets.py3
-rw-r--r--sources/pyside6/tests/QtNetwork/accessManager_test.py1
-rw-r--r--sources/pyside6/tests/QtNetwork/bug_1084.py1
-rw-r--r--sources/pyside6/tests/QtNetwork/bug_446.py1
-rw-r--r--sources/pyside6/tests/QtNetwork/dnslookup_test.py2
-rw-r--r--sources/pyside6/tests/QtNetwork/qipv6address_test.py1
-rw-r--r--sources/pyside6/tests/QtNetwork/qpassworddigestor_test.py2
-rw-r--r--sources/pyside6/tests/QtNetwork/tcpserver_test.py8
-rw-r--r--sources/pyside6/tests/QtNetwork/udpsocket_test.py7
-rw-r--r--sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py3
-rw-r--r--sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py15
-rw-r--r--sources/pyside6/tests/QtPositioning/positioning.py1
-rw-r--r--sources/pyside6/tests/QtPrintSupport/bug_500.py1
-rw-r--r--sources/pyside6/tests/QtPrintSupport/returnquadruplesofnumbers_test.py8
-rw-r--r--sources/pyside6/tests/QtQml/bug_1029.py5
-rw-r--r--sources/pyside6/tests/QtQml/bug_451.py1
-rw-r--r--sources/pyside6/tests/QtQml/bug_456.py2
-rw-r--r--sources/pyside6/tests/QtQml/bug_726.py1
-rw-r--r--sources/pyside6/tests/QtQml/bug_814.py5
-rw-r--r--sources/pyside6/tests/QtQml/bug_825.py14
-rw-r--r--sources/pyside6/tests/QtQml/bug_847.py3
-rw-r--r--sources/pyside6/tests/QtQml/bug_915.py6
-rw-r--r--sources/pyside6/tests/QtQml/bug_926.py9
-rw-r--r--sources/pyside6/tests/QtQml/bug_951.py8
-rw-r--r--sources/pyside6/tests/QtQml/bug_997.py1
-rw-r--r--sources/pyside6/tests/QtQml/connect_python_qml.py1
-rw-r--r--sources/pyside6/tests/QtQml/javascript_exceptions.py4
-rw-r--r--sources/pyside6/tests/QtQml/listproperty.py4
-rw-r--r--sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py3
-rw-r--r--sources/pyside6/tests/QtQml/qqmlnetwork_test.py7
-rw-r--r--sources/pyside6/tests/QtQml/qquickitem_grabToImage.py3
-rw-r--r--sources/pyside6/tests/QtQml/qquickview_test.py2
-rw-r--r--sources/pyside6/tests/QtQml/registersingletontype.py7
-rw-r--r--sources/pyside6/tests/QtQml/registertype.py15
-rw-r--r--sources/pyside6/tests/QtQml/registeruncreatabletype.py8
-rw-r--r--sources/pyside6/tests/QtQml/signal_arguments.py2
-rw-r--r--sources/pyside6/tests/QtScxml/test_dynamic.py2
-rw-r--r--sources/pyside6/tests/QtSensors/sensors.py3
-rw-r--r--sources/pyside6/tests/QtSerialPort/serial.py2
-rw-r--r--sources/pyside6/tests/QtSql/bug_1013.py3
-rw-r--r--sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py10
-rw-r--r--sources/pyside6/tests/QtSql/qvarianttype_test.py1
-rw-r--r--sources/pyside6/tests/QtStateMachine/qabstracttransition_test.py3
-rw-r--r--sources/pyside6/tests/QtStateMachine/qstate_test.py5
-rw-r--r--sources/pyside6/tests/QtStateMachine/setprop_on_ctor_test.py5
-rw-r--r--sources/pyside6/tests/QtSvg/qsvggenerator_test.py2
-rw-r--r--sources/pyside6/tests/QtSvg/qsvgrenderer_test.py2
-rw-r--r--sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py4
-rw-r--r--sources/pyside6/tests/QtTest/click_test.py1
-rw-r--r--sources/pyside6/tests/QtTest/eventfilter_test.py2
-rw-r--r--sources/pyside6/tests/QtTest/qvalidator_test.py6
-rw-r--r--sources/pyside6/tests/QtTest/touchevent_test.py3
-rw-r--r--sources/pyside6/tests/QtTextToSpeech/qtexttospeech_test.py2
-rw-r--r--sources/pyside6/tests/QtUiTools/bug_1060.py1
-rw-r--r--sources/pyside6/tests/QtUiTools/bug_360.py2
-rw-r--r--sources/pyside6/tests/QtUiTools/bug_376.py1
-rw-r--r--sources/pyside6/tests/QtUiTools/bug_392.py3
-rw-r--r--sources/pyside6/tests/QtUiTools/bug_426.py1
-rw-r--r--sources/pyside6/tests/QtUiTools/bug_552.py1
-rw-r--r--sources/pyside6/tests/QtUiTools/bug_909.py2
-rw-r--r--sources/pyside6/tests/QtUiTools/bug_913.py5
-rw-r--r--sources/pyside6/tests/QtUiTools/bug_958.py4
-rw-r--r--sources/pyside6/tests/QtUiTools/bug_965.py3
-rw-r--r--sources/pyside6/tests/QtUiTools/loadUiType_test.py1
-rw-r--r--sources/pyside6/tests/QtUiTools/ui_test.py2
-rw-r--r--sources/pyside6/tests/QtUiTools/uiloader_test.py1
-rw-r--r--sources/pyside6/tests/QtWebEngine/web_engine_initialize.py1
-rw-r--r--sources/pyside6/tests/QtWebEngineCore/web_engine_custom_scheme.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/action_clear.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/add_action_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/api2_test.py11
-rw-r--r--sources/pyside6/tests/QtWidgets/application_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1002.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1006.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_1077.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_243.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_307.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_324.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_338.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_389.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_400.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_430.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_433.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_467.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_493.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_512.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_525.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_546.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_547.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_549.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_569.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_575.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_585.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_589.py18
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_635.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_640.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_653.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_662.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_667.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_668.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_674.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_688.py11
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_693.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_696.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_711.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_722.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_728.py7
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_750.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_778.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_785.py9
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_793.py9
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_811.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_834.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_836.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_844.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_854.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_860.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_862.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_871.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_879.py7
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_919.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_921.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_941.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_964.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_967.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_972.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_979.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_988.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_998.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/customproxywidget_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/event_filter_test.py10
-rw-r--r--sources/pyside6/tests/QtWidgets/grandparent_method_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/hashabletype_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/keep_reference_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/missing_symbols_test.py15
-rw-r--r--sources/pyside6/tests/QtWidgets/paint_event_test.py13
-rw-r--r--sources/pyside6/tests/QtWidgets/parent_method_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/private_mangle_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/python_properties_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qaction_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qapp_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qapplication_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qbrush_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qdynamic_signal.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qfontdialog_test.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/qformlayout_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py8
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py55
-rw-r--r--sources/pyside6/tests/QtWidgets/qimage_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qlabel_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qlayout_ref_test.py26
-rw-r--r--sources/pyside6/tests/QtWidgets/qlayout_test.py14
-rw-r--r--sources/pyside6/tests/QtWidgets/qlcdnumber_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qlistwidget_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qmainwindow_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qmenu_test.py11
-rw-r--r--sources/pyside6/tests/QtWidgets/qmenuadd_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qobject_mi_test.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/qpen_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qpicture_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/qpixmap_constructor.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qpushbutton_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qshortcut_test.py10
-rw-r--r--sources/pyside6/tests/QtWidgets/qsplitter_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py14
-rw-r--r--sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qstyle_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qtableview_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qtabwidget_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qtextedit_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qtoolbar_test.py8
-rw-r--r--sources/pyside6/tests/QtWidgets/qtoolbox_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/qtreeview_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/qtreewidget_test.py6
-rw-r--r--sources/pyside6/tests/QtWidgets/qvariant_test.py7
-rw-r--r--sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qwidget_test.py5
-rw-r--r--sources/pyside6/tests/QtWidgets/reference_count_test.py12
-rw-r--r--sources/pyside6/tests/QtWidgets/signature_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/standardpixmap_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/test_module_template.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py12
-rw-r--r--sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py1
-rw-r--r--sources/pyside6/tests/QtWidgets/wrong_return_test.py1
-rw-r--r--sources/pyside6/tests/QtXml/qdomdocument_test.py1
-rw-r--r--sources/pyside6/tests/mac/qmacstyle_test.py2
-rw-r--r--sources/pyside6/tests/manually/bug_841.py5
-rw-r--r--sources/pyside6/tests/pysidetest/all_modules_load_test.py2
-rw-r--r--sources/pyside6/tests/pysidetest/bug_1016.py1
-rw-r--r--sources/pyside6/tests/pysidetest/decoratedslot_test.py1
-rw-r--r--sources/pyside6/tests/pysidetest/delegatecreateseditor_test.py1
-rw-r--r--sources/pyside6/tests/pysidetest/embedding_test.py1
-rw-r--r--sources/pyside6/tests/pysidetest/enum_test.py2
-rw-r--r--sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py2
-rw-r--r--sources/pyside6/tests/pysidetest/iterable_test.py1
-rw-r--r--sources/pyside6/tests/pysidetest/list_signal_test.py2
-rw-r--r--sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py8
-rw-r--r--sources/pyside6/tests/pysidetest/modelview_test.py5
-rw-r--r--sources/pyside6/tests/pysidetest/new_inherited_functions_test.py5
-rw-r--r--sources/pyside6/tests/pysidetest/notify_id.py3
-rw-r--r--sources/pyside6/tests/pysidetest/property_python_test.py14
-rw-r--r--sources/pyside6/tests/pysidetest/qapp_like_a_macro_test.py7
-rw-r--r--sources/pyside6/tests/pysidetest/qvariant_test.py2
-rw-r--r--sources/pyside6/tests/pysidetest/repr_test.py2
-rw-r--r--sources/pyside6/tests/pysidetest/signal_slot_warning.py1
-rw-r--r--sources/pyside6/tests/pysidetest/signalandnamespace_test.py3
-rw-r--r--sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py6
-rw-r--r--sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py6
-rw-r--r--sources/pyside6/tests/pysidetest/typedef_signal_test.py3
-rw-r--r--sources/pyside6/tests/pysidetest/version_test.py1
-rw-r--r--sources/pyside6/tests/registry/existence_test.py2
-rw-r--r--sources/pyside6/tests/registry/init_platform.py5
-rw-r--r--sources/pyside6/tests/registry/scrape_testresults.py17
-rw-r--r--sources/pyside6/tests/registry/util.py14
-rw-r--r--sources/pyside6/tests/signals/args_dont_match_test.py1
-rw-r--r--sources/pyside6/tests/signals/bug_311.py10
-rw-r--r--sources/pyside6/tests/signals/bug_312.py5
-rw-r--r--sources/pyside6/tests/signals/bug_319.py5
-rw-r--r--sources/pyside6/tests/signals/bug_79.py1
-rw-r--r--sources/pyside6/tests/signals/decorators_test.py4
-rw-r--r--sources/pyside6/tests/signals/disconnect_test.py2
-rw-r--r--sources/pyside6/tests/signals/invalid_callback_test.py8
-rw-r--r--sources/pyside6/tests/signals/lambda_gui_test.py5
-rw-r--r--sources/pyside6/tests/signals/lambda_test.py4
-rw-r--r--sources/pyside6/tests/signals/leaking_signal_test.py1
-rw-r--r--sources/pyside6/tests/signals/multiple_connections_gui_test.py3
-rw-r--r--sources/pyside6/tests/signals/multiple_connections_test.py4
-rw-r--r--sources/pyside6/tests/signals/pysignal_test.py3
-rw-r--r--sources/pyside6/tests/signals/qobject_destroyed_test.py2
-rw-r--r--sources/pyside6/tests/signals/qobject_receivers_test.py2
-rw-r--r--sources/pyside6/tests/signals/qobject_sender_test.py6
-rw-r--r--sources/pyside6/tests/signals/ref01_test.py2
-rw-r--r--sources/pyside6/tests/signals/ref02_test.py2
-rw-r--r--sources/pyside6/tests/signals/ref03_test.py2
-rw-r--r--sources/pyside6/tests/signals/ref04_test.py1
-rw-r--r--sources/pyside6/tests/signals/ref05_test.py1
-rw-r--r--sources/pyside6/tests/signals/ref06_test.py1
-rw-r--r--sources/pyside6/tests/signals/segfault_proxyparent_test.py3
-rw-r--r--sources/pyside6/tests/signals/self_connect_test.py1
-rw-r--r--sources/pyside6/tests/signals/short_circuit_test.py5
-rw-r--r--sources/pyside6/tests/signals/signal2signal_connect_test.py16
-rw-r--r--sources/pyside6/tests/signals/signal_autoconnect_test.py1
-rw-r--r--sources/pyside6/tests/signals/signal_connectiontype_support_test.py2
-rw-r--r--sources/pyside6/tests/signals/signal_emission_gui_test.py2
-rw-r--r--sources/pyside6/tests/signals/signal_emission_test.py16
-rw-r--r--sources/pyside6/tests/signals/signal_enum_test.py1
-rw-r--r--sources/pyside6/tests/signals/signal_func_test.py6
-rw-r--r--sources/pyside6/tests/signals/signal_manager_refcount_test.py2
-rw-r--r--sources/pyside6/tests/signals/signal_number_limit_test.py2
-rw-r--r--sources/pyside6/tests/signals/signal_object_test.py2
-rw-r--r--sources/pyside6/tests/signals/signal_signature_test.py8
-rw-r--r--sources/pyside6/tests/signals/signal_with_primitive_type_test.py1
-rw-r--r--sources/pyside6/tests/signals/slot_reference_count_test.py4
-rw-r--r--sources/pyside6/tests/signals/static_metaobject_test.py3
-rw-r--r--sources/pyside6/tests/support/voidptr_test.py2
-rw-r--r--sources/pyside6/tests/tools/list-class-hierarchy.py24
-rw-r--r--sources/pyside6/tests/util/color.py1
-rw-r--r--sources/pyside6/tests/util/httpd.py5
-rw-r--r--sources/pyside6/tests/util/processtimer.py71
-rw-r--r--sources/pyside6/tests/util/pyqt_diff.py2
-rw-r--r--sources/pyside6/tests/util/test_processtimer.py7
447 files changed, 1540 insertions, 583 deletions
diff --git a/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py b/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py
index 29294c61d..19fe1a9f0 100644
--- a/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py
+++ b/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py
@@ -41,12 +41,13 @@ init_test_paths(False)
from helper.usesqguiapplication import UsesQGuiApplication
-from PySide6.QtCore import(Property, QObject, QPropertyAnimation, QTimer, Signal, Slot)
+from PySide6.QtCore import (Property, QObject, QPropertyAnimation, QTimer, Signal, Slot)
from PySide6.QtGui import (QGuiApplication, QMatrix4x4, QQuaternion, QVector3D, QWindow)
from PySide6.Qt3DCore import (Qt3DCore)
from PySide6.Qt3DRender import (Qt3DRender)
from PySide6.Qt3DExtras import (Qt3DExtras)
+
class OrbitTransformController(QObject):
def __init__(self, parent):
super().__init__(parent)
@@ -80,7 +81,7 @@ class OrbitTransformController(QObject):
return self._angle
def updateMatrix(self):
- self._matrix.setToIdentity();
+ self._matrix.setToIdentity()
self._matrix.rotate(self._angle, QVector3D(0, 1, 0))
self._matrix.translate(self._radius, 0, 0)
if self._target is not None:
@@ -91,6 +92,7 @@ class OrbitTransformController(QObject):
angle = Property(float, getAngle, setAngle, notify=angleChanged)
radius = Property(float, getRadius, setRadius, notify=radiusChanged)
+
class Window(Qt3DExtras.Qt3DWindow):
def __init__(self):
super().__init__()
@@ -146,6 +148,7 @@ class Window(Qt3DExtras.Qt3DWindow):
self.sphereEntity.addComponent(self.sphereTransform)
self.sphereEntity.addComponent(self.material)
+
class Qt3DExtrasTestCase(UsesQGuiApplication):
'''Tests related to Q3DExtras'''
@@ -158,5 +161,6 @@ class Qt3DExtrasTestCase(UsesQGuiApplication):
QTimer.singleShot(2000, self.app.quit)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCharts/qcharts_test.py b/sources/pyside6/tests/QtCharts/qcharts_test.py
index c3e1ce805..07e33218a 100644
--- a/sources/pyside6/tests/QtCharts/qcharts_test.py
+++ b/sources/pyside6/tests/QtCharts/qcharts_test.py
@@ -44,21 +44,22 @@ from PySide6.QtCore import QRect, QSize, QTimer
from PySide6.QtGui import QGuiApplication, QScreen
from PySide6.QtCharts import QChart, QChartView, QPieSeries
+
class QChartsTestCase(UsesQApplication):
'''Tests related to QCharts'''
def testCharts(self):
self.series = QPieSeries()
- self.series.append("Jane", 1);
- self.series.append("Joe", 2);
- self.series.append("Andy", 3);
- self.series.append("Barbara", 4);
- self.series.append("Axel", 5);
+ self.series.append("Jane", 1)
+ self.series.append("Joe", 2)
+ self.series.append("Andy", 3)
+ self.series.append("Barbara", 4)
+ self.series.append("Axel", 5)
slice = self.series.slices()[1]
- slice.setExploded();
- slice.setLabelVisible();
+ slice.setExploded()
+ slice.setLabelVisible()
self.chart = QChart()
- self.chart.addSeries(self.series);
+ self.chart.addSeries(self.series)
chartView = QChartView(self.chart)
screenSize = QGuiApplication.primaryScreen().geometry().size()
chartView.resize(screenSize / 2)
@@ -66,5 +67,6 @@ class QChartsTestCase(UsesQApplication):
QTimer.singleShot(500, self.app.quit)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/blocking_signals_test.py b/sources/pyside6/tests/QtCore/blocking_signals_test.py
index 92382c1d4..b51ba2c7a 100644
--- a/sources/pyside6/tests/QtCore/blocking_signals_test.py
+++ b/sources/pyside6/tests/QtCore/blocking_signals_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, QFile, QSignalBlocker
+
class TestSignalsBlockedBasic(unittest.TestCase):
'''Basic test case for signalsBlocked'''
@@ -73,25 +74,25 @@ class TestSignalsBlocked(unittest.TestCase):
'''Test case to check if the signals are really blocked'''
def setUp(self):
- #Set up the basic resources needed
+ # Set up the basic resources needed
self.obj = QObject()
self.args = tuple()
self.called = False
def tearDown(self):
- #Delete used resources
+ # Delete used resources
del self.obj
del self.args
def callback(self, *args):
- #Default callback
- if args == self.args:
+ # Default callback
+ if args == self.args:
self.called = True
else:
raise TypeError("Invalid arguments")
def testShortCircuitSignals(self):
- #Blocking of Python short-circuit signals
+ # Blocking of Python short-circuit signals
QObject.connect(self.obj, SIGNAL('mysignal()'), self.callback)
self.obj.emit(SIGNAL('mysignal()'))
@@ -103,7 +104,7 @@ class TestSignalsBlocked(unittest.TestCase):
self.assertTrue(not self.called)
def testPythonSignals(self):
- #Blocking of Python typed signals
+ # Blocking of Python typed signals
QObject.connect(self.obj, SIGNAL('mysignal(int,int)'), self.callback)
self.args = (1, 3)
@@ -115,11 +116,12 @@ class TestSignalsBlocked(unittest.TestCase):
self.obj.emit(SIGNAL('mysignal(int,int)'), *self.args)
self.assertTrue(not self.called)
+
class TestQFileSignalBlocking(unittest.TestCase):
'''Test case for blocking the signal QIODevice.aboutToClose()'''
def setUp(self):
- #Set up the needed resources - A temp file and a QFile
+ # Set up the needed resources - A temp file and a QFile
self.called = False
handle, self.filename = mkstemp()
os.close(handle)
@@ -127,16 +129,16 @@ class TestQFileSignalBlocking(unittest.TestCase):
self.qfile = QFile(self.filename)
def tearDown(self):
- #Release acquired resources
+ # Release acquired resources
os.remove(self.filename)
del self.qfile
def callback(self):
- #Default callback
+ # Default callback
self.called = True
def testAboutToCloseBlocking(self):
- #QIODevice.aboutToClose() blocking
+ # QIODevice.aboutToClose() blocking
QObject.connect(self.qfile, SIGNAL('aboutToClose()'), self.callback)
diff --git a/sources/pyside6/tests/QtCore/bug_1019.py b/sources/pyside6/tests/QtCore/bug_1019.py
index c7f1ea358..f3a37f42c 100644
--- a/sources/pyside6/tests/QtCore/bug_1019.py
+++ b/sources/pyside6/tests/QtCore/bug_1019.py
@@ -47,6 +47,7 @@ class MyTimer (QTimer):
def slotUsedToIncreaseMethodOffset(self):
pass
+
class MyTimer2 (MyTimer):
@Slot()
@@ -57,6 +58,7 @@ class MyTimer2 (MyTimer):
self.startCalled = True
QCoreApplication.instance().quit()
+
class TestBug1019 (unittest.TestCase):
def testIt(self):
app = QCoreApplication([])
@@ -65,5 +67,6 @@ class TestBug1019 (unittest.TestCase):
app.exec_()
self.assertTrue(t.startCalled)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_1063.py b/sources/pyside6/tests/QtCore/bug_1063.py
index c92f4f191..e83886221 100644
--- a/sources/pyside6/tests/QtCore/bug_1063.py
+++ b/sources/pyside6/tests/QtCore/bug_1063.py
@@ -61,5 +61,6 @@ class QTextStreamTestCase(unittest.TestCase):
os.unlink(self.temp_file.name)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_1069.py b/sources/pyside6/tests/QtCore/bug_1069.py
index 505ebdb8f..ca99a408d 100644
--- a/sources/pyside6/tests/QtCore/bug_1069.py
+++ b/sources/pyside6/tests/QtCore/bug_1069.py
@@ -55,5 +55,6 @@ class QDataStreamOpOverloadTestCase(unittest.TestCase):
self.assertEqual(ok, True)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_1313.py b/sources/pyside6/tests/QtCore/bug_1313.py
index a80c81cc8..d384b44ba 100644
--- a/sources/pyside6/tests/QtCore/bug_1313.py
+++ b/sources/pyside6/tests/QtCore/bug_1313.py
@@ -67,7 +67,7 @@ def demo_generator():
my_qobject = MyQObject()
my_qobject.sig.connect(lambda: None)
return
- yield # to make it a generator
+ yield # to make it a generator
class GeneratorRaisesStopIterationTestCase(unittest.TestCase):
diff --git a/sources/pyside6/tests/QtCore/bug_278_test.py b/sources/pyside6/tests/QtCore/bug_278_test.py
index f4ce190b8..b130d2b03 100644
--- a/sources/pyside6/tests/QtCore/bug_278_test.py
+++ b/sources/pyside6/tests/QtCore/bug_278_test.py
@@ -44,6 +44,7 @@ def setValue(o):
values = ['Name']
o.setProperty('test1', values)
+
class QQtVersionTest(unittest.TestCase):
'''Tests for QVariant conversion of QStringList'''
@@ -53,7 +54,6 @@ class QQtVersionTest(unittest.TestCase):
self.assertEqual(o.property('test1'), ['Name'])
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_332.py b/sources/pyside6/tests/QtCore/bug_332.py
index 6b2e62db8..333f7fcdf 100644
--- a/sources/pyside6/tests/QtCore/bug_332.py
+++ b/sources/pyside6/tests/QtCore/bug_332.py
@@ -41,14 +41,15 @@ from PySide6.QtCore import QMutex
class Lock(QMutex):
- def tryLock(self,timeoutt=10):
- return QMutex.tryLock(self,timeoutt)
+ def tryLock(self, timeout=10):
+ return QMutex.tryLock(self, timeout)
+
class TestBug(unittest.TestCase):
def testCase(self):
l = Lock()
- l.tryLock() # this cause a assertion
+ l.tryLock() # this cause a assertion
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtCore/bug_408.py b/sources/pyside6/tests/QtCore/bug_408.py
index b5cd63c22..cb501bcfb 100644
--- a/sources/pyside6/tests/QtCore/bug_408.py
+++ b/sources/pyside6/tests/QtCore/bug_408.py
@@ -50,6 +50,7 @@ class MyDevice(QIODevice):
self.ptr += size
return retval
+
class QIODeviceTest(unittest.TestCase):
def testIt(self):
@@ -60,5 +61,6 @@ class QIODeviceTest(unittest.TestCase):
self.assertEqual(s.readLine(), "hello world")
self.assertEqual(s.readLine(), "hello again")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_428.py b/sources/pyside6/tests/QtCore/bug_428.py
index 7b4a730c0..184f7a30d 100644
--- a/sources/pyside6/tests/QtCore/bug_428.py
+++ b/sources/pyside6/tests/QtCore/bug_428.py
@@ -37,11 +37,13 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class MyBaseObject(QObject):
def __init__(self, number):
self.myMember = 'myMember' + number
super().__init__()
+
class QObjectConstructorTest(unittest.TestCase):
def testBug(self):
for i in range(10):
@@ -49,5 +51,6 @@ class QObjectConstructorTest(unittest.TestCase):
obj = MyBaseObject(number)
self.assertEqual(obj.myMember, 'myMember' + number)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_462.py b/sources/pyside6/tests/QtCore/bug_462.py
index 6af2590ee..95772b9fd 100644
--- a/sources/pyside6/tests/QtCore/bug_462.py
+++ b/sources/pyside6/tests/QtCore/bug_462.py
@@ -37,21 +37,24 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QCoreApplication, QEvent, QThread
+
class MyEvent(QEvent):
- def __init__(self,i):
+ def __init__(self, i):
print("TYPE:", type(QEvent.User))
- super().__init__(QEvent.Type(QEvent.User + 100 ))
+ super().__init__(QEvent.Type(QEvent.User + 100))
self.i = i
+
class MyThread (QThread):
- def __init__(self,owner):
+ def __init__(self, owner):
super().__init__()
- self.owner=owner;
+ self.owner = owner
def run(self):
for i in range(3):
- e=MyEvent(i);
- QCoreApplication.postEvent(self.owner,e)
+ e = MyEvent(i)
+ QCoreApplication.postEvent(self.owner, e)
+
class MyBaseObject(QObject):
def __init__(self):
@@ -76,5 +79,6 @@ class CheckForEventsTypes(unittest.TestCase):
self.assertTrue(isinstance(e, MyEvent))
o.app = None
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_505.py b/sources/pyside6/tests/QtCore/bug_505.py
index 5b3fba93d..a00973fea 100644
--- a/sources/pyside6/tests/QtCore/bug_505.py
+++ b/sources/pyside6/tests/QtCore/bug_505.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class MyBaseObject(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
@@ -46,6 +47,7 @@ class MyBaseObject(QObject):
if self.objectName() != "PySide":
raise NameError('Fail')
+
class CheckForEventsTypes(unittest.TestCase):
def testDelObject(self):
p = MyBaseObject()
@@ -53,5 +55,6 @@ class CheckForEventsTypes(unittest.TestCase):
del o
del p
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_515.py b/sources/pyside6/tests/QtCore/bug_515.py
index 917357f88..2e9ff83d6 100644
--- a/sources/pyside6/tests/QtCore/bug_515.py
+++ b/sources/pyside6/tests/QtCore/bug_515.py
@@ -42,14 +42,18 @@ from PySide6.QtCore import QCoreApplication, qAddPostRoutine
callCleanup = False
+
+
def _cleanup():
global callCleanup
callCleanup = True
+
def _checkCleanup():
global callCleanup
assert(callCleanup)
+
app = QCoreApplication([])
qAddPostRoutine(_cleanup)
qAddPostRoutine(_checkCleanup)
diff --git a/sources/pyside6/tests/QtCore/bug_606.py b/sources/pyside6/tests/QtCore/bug_606.py
index abe4ab2ca..f1245456c 100644
--- a/sources/pyside6/tests/QtCore/bug_606.py
+++ b/sources/pyside6/tests/QtCore/bug_606.py
@@ -40,6 +40,7 @@ from PySide6.QtCore import QPoint, QPointF
from PySide6.QtCore import QLine, QLineF
from PySide6.QtCore import QSize, QSizeF
+
class testCases(unittest.TestCase):
def testQPointToTuple(self):
p = QPoint(1, 2)
@@ -65,5 +66,6 @@ class testCases(unittest.TestCase):
s = QSizeF(1, 2)
self.assertEqual((1, 2), s.toTuple())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_656.py b/sources/pyside6/tests/QtCore/bug_656.py
index f0539c700..d58261dc2 100644
--- a/sources/pyside6/tests/QtCore/bug_656.py
+++ b/sources/pyside6/tests/QtCore/bug_656.py
@@ -39,9 +39,10 @@ from PySide6.QtCore import QCoreApplication
class CoreApp(QCoreApplication):
- def __init__(self,*args):
+ def __init__(self, *args):
super().__init__(*args)
# It shouldn't crash after the __init__ call
+
import sys
app = CoreApp(sys.argv)
diff --git a/sources/pyside6/tests/QtCore/bug_686.py b/sources/pyside6/tests/QtCore/bug_686.py
index ff9a64d50..e4c027ee1 100644
--- a/sources/pyside6/tests/QtCore/bug_686.py
+++ b/sources/pyside6/tests/QtCore/bug_686.py
@@ -53,6 +53,7 @@ class MyWriteThread(QThread):
self.lock.unlock()
self.canQuit = True
+
class MyReadThread(QThread):
def __init__(self, lock):
super().__init__()
@@ -67,6 +68,7 @@ class MyReadThread(QThread):
self.lock.unlock()
self.canQuit = True
+
class MyMutexedThread(QThread):
def __init__(self, mutex):
super().__init__()
@@ -81,6 +83,7 @@ class MyMutexedThread(QThread):
self.mutex.unlock()
self.canQuit = True
+
class TestQMutex (unittest.TestCase):
def testReadLocker(self):
@@ -122,5 +125,6 @@ class TestQMutex (unittest.TestCase):
thread.wait(2000)
self.assertTrue(thread.canQuit)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_699.py b/sources/pyside6/tests/QtCore/bug_699.py
index 2abfc0819..e624640d2 100644
--- a/sources/pyside6/tests/QtCore/bug_699.py
+++ b/sources/pyside6/tests/QtCore/bug_699.py
@@ -50,5 +50,6 @@ class TestBug699 (unittest.TestCase):
def testIt(self):
self.assertRaises(TypeError, self.defClass)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_706.py b/sources/pyside6/tests/QtCore/bug_706.py
index c9c961f57..813181726 100644
--- a/sources/pyside6/tests/QtCore/bug_706.py
+++ b/sources/pyside6/tests/QtCore/bug_706.py
@@ -39,9 +39,10 @@ from PySide6.QtCore import QAbstractListModel, QCoreApplication, QModelIndex
class MyModel (QAbstractListModel):
- def rowCount(self, parent = None):
+ def rowCount(self, parent=None):
return 3
+
class TestBug706(unittest.TestCase):
def mySlot(self, idx, start, end):
@@ -59,5 +60,6 @@ class TestBug706(unittest.TestCase):
self.assertEqual(self.start, 0)
self.assertEqual(self.end, 1)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_820.py b/sources/pyside6/tests/QtCore/bug_820.py
index 501dd9ce1..dfd6c6b63 100644
--- a/sources/pyside6/tests/QtCore/bug_820.py
+++ b/sources/pyside6/tests/QtCore/bug_820.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Slot, Signal, SIGNAL
+
def log_exception():
def log_exception_decorator(func):
@functools.wraps(func)
@@ -64,6 +65,7 @@ def log_exception2():
return log_exception_decorator
+
class MyObject(QObject):
def __init__(self, parent=None):
@@ -99,6 +101,7 @@ class SlotWithDecoratorTest(unittest.TestCase):
self.assertTrue(o._mySlotcalled)
self.assertTrue(o._mySlot2called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_826.py b/sources/pyside6/tests/QtCore/bug_826.py
index a6ef2667a..3b1fb3714 100644
--- a/sources/pyside6/tests/QtCore/bug_826.py
+++ b/sources/pyside6/tests/QtCore/bug_826.py
@@ -41,6 +41,7 @@ import PySide6
TEST_EVENT_TYPE = QEvent.Type(QEvent.registerEventType())
+
class TestEvent(QEvent):
TestEventType = QEvent.Type(QEvent.registerEventType())
@@ -61,5 +62,6 @@ class TestEnums(unittest.TestCase):
self.assertEqual(eval(repr(TestEvent.TestEventType)), TestEvent.TestEventType)
self.assertEqual(eval(repr(TEST_EVENT_TYPE)), TEST_EVENT_TYPE)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_829.py b/sources/pyside6/tests/QtCore/bug_829.py
index 54f461850..c5636f62a 100644
--- a/sources/pyside6/tests/QtCore/bug_829.py
+++ b/sources/pyside6/tests/QtCore/bug_829.py
@@ -69,5 +69,6 @@ class QVariantConversions(unittest.TestCase):
if self._confFileName is not None:
os.unlink(QDir.toNativeSeparators(self._confFileName))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_835.py b/sources/pyside6/tests/QtCore/bug_835.py
index 788ead4c9..e2217ed0c 100644
--- a/sources/pyside6/tests/QtCore/bug_835.py
+++ b/sources/pyside6/tests/QtCore/bug_835.py
@@ -41,6 +41,7 @@ from PySide6.QtCore import QObject
get_counter = 0
set_counter = 0
+
class Descriptor(object):
def __get__(self, obj, owner):
global get_counter
@@ -57,10 +58,12 @@ class Descriptor(object):
set_counter += 1
obj.var = value
+
class FooBar(QObject):
test = Descriptor()
var = 0
+
class SetAndGetTestCases(unittest.TestCase):
def setUp(self):
global get_counter
@@ -97,5 +100,6 @@ class SetAndGetTestCases(unittest.TestCase):
get_counter = 0
set_counter = 0
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_920.py b/sources/pyside6/tests/QtCore/bug_920.py
index 7caea3810..e3e087c72 100644
--- a/sources/pyside6/tests/QtCore/bug_920.py
+++ b/sources/pyside6/tests/QtCore/bug_920.py
@@ -39,10 +39,12 @@ init_test_paths(False)
import PySide6.QtCore as QtCore
+
class Signaller(QtCore.QObject):
s1 = QtCore.Signal()
s2 = QtCore.Signal()
+
class TestBug920(unittest.TestCase):
def testIt(self):
diff --git a/sources/pyside6/tests/QtCore/bug_927.py b/sources/pyside6/tests/QtCore/bug_927.py
index 80f332979..1a9617481 100644
--- a/sources/pyside6/tests/QtCore/bug_927.py
+++ b/sources/pyside6/tests/QtCore/bug_927.py
@@ -38,22 +38,24 @@ init_test_paths(False)
from PySide6.QtCore import QTime, QRunnable, QThreadPool
+
class Task(QRunnable):
- def run(self):
- t = QTime()
- t.start()
- time.sleep(2) # Sleep 2 seconds
+ def run(self):
+ t = QTime()
+ t.start()
+ time.sleep(2) # Sleep 2 seconds
class QThreadPoolTest(unittest.TestCase):
'''This used to cause a segfault due the ownership control on globalInstance function '''
def testSlowJobs(self):
- for i in range(3):
- task = Task()
- QThreadPool.globalInstance().start(task)
- time.sleep(1) # Sleep 1 second
+ for i in range(3):
+ task = Task()
+ QThreadPool.globalInstance().start(task)
+ time.sleep(1) # Sleep 1 second
+
+ QThreadPool.globalInstance().waitForDone()
- QThreadPool.globalInstance().waitForDone()
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_931.py b/sources/pyside6/tests/QtCore/bug_931.py
index 1dcde427f..5f4f3b14c 100644
--- a/sources/pyside6/tests/QtCore/bug_931.py
+++ b/sources/pyside6/tests/QtCore/bug_931.py
@@ -37,9 +37,12 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Signal
o = QObject()
+
+
class MyObject(QObject):
s = Signal(int)
+
class CheckSignalType(unittest.TestCase):
def testSignal(self):
self.assertTrue(isinstance(QObject.destroyed, Signal))
@@ -52,5 +55,6 @@ class CheckSignalType(unittest.TestCase):
self.assertTrue(isinstance(MyObject.s, Signal))
self.assertFalse(isinstance(int, Signal))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_938.py b/sources/pyside6/tests/QtCore/bug_938.py
index 9965eec95..823a99e3b 100644
--- a/sources/pyside6/tests/QtCore/bug_938.py
+++ b/sources/pyside6/tests/QtCore/bug_938.py
@@ -47,5 +47,6 @@ class TestBug938 (unittest.TestCase):
b.close()
self.assertEqual(b.buffer().size(), 5)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_953.py b/sources/pyside6/tests/QtCore/bug_953.py
index 25f2819e0..39f27cfe0 100644
--- a/sources/pyside6/tests/QtCore/bug_953.py
+++ b/sources/pyside6/tests/QtCore/bug_953.py
@@ -47,9 +47,10 @@ class Dispatcher(QObject):
QTimer.singleShot(0, self._finish)
def _finish(self):
- del self._me # It can't crash here!
+ del self._me # It can't crash here!
QTimer.singleShot(10, QCoreApplication.instance().quit)
+
if __name__ == '__main__':
app = QCoreApplication([])
Dispatcher()
diff --git a/sources/pyside6/tests/QtCore/bug_987.py b/sources/pyside6/tests/QtCore/bug_987.py
index d5a2bcd33..42d1f5fcf 100644
--- a/sources/pyside6/tests/QtCore/bug_987.py
+++ b/sources/pyside6/tests/QtCore/bug_987.py
@@ -46,5 +46,6 @@ class TestBug987(unittest.TestCase):
o = QObject()
self.assertRaises(RuntimeError, o.destroyed.disconnect, self.callback)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_994.py b/sources/pyside6/tests/QtCore/bug_994.py
index 1e1e137d8..adf41b2d3 100644
--- a/sources/pyside6/tests/QtCore/bug_994.py
+++ b/sources/pyside6/tests/QtCore/bug_994.py
@@ -40,7 +40,7 @@ from PySide6.QtCore import QIODevice, QTextStream
class MyIODevice (QIODevice):
def readData(self, amount):
- return bytes("\0a" * int(amount/2), "UTF-8")
+ return bytes("\0a" * int(amount / 2), "UTF-8")
def readLineData(self, maxSize):
return bytes("\0b" * 4, "UTF-8")
@@ -48,6 +48,7 @@ class MyIODevice (QIODevice):
def atEnd(self):
return False
+
class TestBug944 (unittest.TestCase):
def testIt(self):
@@ -57,5 +58,6 @@ class TestBug944 (unittest.TestCase):
self.assertEqual(s.read(4), "\0a\0a")
self.assertEqual(device.readLine(), "\0b\0b\0b\0b")
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py b/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py
index 826021215..36e9bd27d 100644
--- a/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py
+++ b/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QCoreApplication, QEventLoop, QObject, Qt, QThread, QTimer, SIGNAL
+
class Emitter(QThread):
def __init__(self):
super().__init__()
@@ -46,6 +47,7 @@ class Emitter(QThread):
self.emit(SIGNAL("signal(int)"), 0)
print("After emit.")
+
class Receiver(QObject):
def __init__(self, eventloop):
super().__init__()
@@ -70,5 +72,6 @@ class TestBugPYSIDE164(unittest.TestCase):
emitter.wait(2000)
self.assertEqual(retval, 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py b/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py
index b2a79ea81..448312606 100644
--- a/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py
+++ b/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py
@@ -49,5 +49,6 @@ class TestBugPYSIDE42 (unittest.TestCase):
self.assertNotEqual(hash1, hash2)
self.assertEqual(hash1, hash(obj1))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/child_event_test.py b/sources/pyside6/tests/QtCore/child_event_test.py
index e7d7756f1..29c51e2aa 100644
--- a/sources/pyside6/tests/QtCore/child_event_test.py
+++ b/sources/pyside6/tests/QtCore/child_event_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QTimer, QCoreApplication
from helper.usesqcoreapplication import UsesQCoreApplication
+
class ExtQObject(QObject):
def __init__(self):
super().__init__()
@@ -51,6 +52,7 @@ class ExtQObject(QObject):
QObject.childEvent(self, event)
self.child_event_received = True
+
class ExtQTimer(QTimer):
def __init__(self):
super().__init__()
@@ -82,6 +84,7 @@ class TestChildEvent(UsesQCoreApplication):
child.setParent(parent)
self.assertTrue(parent.child_event_received)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/classinfo_test.py b/sources/pyside6/tests/QtCore/classinfo_test.py
index e6a0a9256..7fed56bf7 100644
--- a/sources/pyside6/tests/QtCore/classinfo_test.py
+++ b/sources/pyside6/tests/QtCore/classinfo_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QCoreApplication, ClassInfo
+
class TestClassInfo(unittest.TestCase):
def test_metadata(self):
@ClassInfo(author='pyside', url='http://www.pyside.org')
@@ -48,11 +49,11 @@ class TestClassInfo(unittest.TestCase):
mo = o.metaObject()
self.assertEqual(mo.classInfoCount(), 2)
- ci = mo.classInfo(0) #author
+ ci = mo.classInfo(0) # author
self.assertEqual(ci.name(), 'author')
self.assertEqual(ci.value(), 'pyside')
- ci = mo.classInfo(1) #url
+ ci = mo.classInfo(1) # url
self.assertEqual(ci.name(), 'url')
self.assertEqual(ci.value(), 'http://www.pyside.org')
@@ -93,20 +94,26 @@ class TestClassInfo(unittest.TestCase):
self.assertRaises(TypeError, decorator, MyObject2)
def test_can_only_be_used_on_qobjects(self):
- def test_function(): pass
+ def test_function():
+ pass
self.assertRaises(TypeError, ClassInfo(), test_function)
- class NotAQObject(object): pass
+ class NotAQObject(object):
+ pass
self.assertRaises(TypeError, ClassInfo(), NotAQObject)
- class QObjectSubclass(QObject): pass
+ class QObjectSubclass(QObject):
+ pass
ClassInfo()(QObjectSubclass)
- class SubclassOfNativeQObjectSubclass(QCoreApplication): pass
+ class SubclassOfNativeQObjectSubclass(QCoreApplication):
+ pass
ClassInfo()(SubclassOfNativeQObjectSubclass)
- class SubclassOfPythonQObjectSubclass(QObjectSubclass): pass
+ class SubclassOfPythonQObjectSubclass(QObjectSubclass):
+ pass
ClassInfo()(SubclassOfPythonQObjectSubclass)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/deepcopy_test.py b/sources/pyside6/tests/QtCore/deepcopy_test.py
index 711b023a9..ef9a72fb5 100644
--- a/sources/pyside6/tests/QtCore/deepcopy_test.py
+++ b/sources/pyside6/tests/QtCore/deepcopy_test.py
@@ -44,12 +44,14 @@ try:
except ImportError:
HAVE_Q = False
+
class DeepCopyHelper:
def testCopy(self):
copy = deepcopy([self.original])[0]
self.assertTrue(copy is not self.original)
self.assertEqual(copy, self.original)
+
class QByteArrayDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QByteArray(bytes('the quick brown fox jumps over the lazy dog', "UTF-8"))
@@ -89,30 +91,37 @@ class QRectFDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QRectF(100.33, 200.254, 300.321, 400.123)
+
class QLineDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QLine(1, 2, 3, 4)
+
class QLineFDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QLineF(1.1, 2.2, 3.3, 4.4)
+
class QPointDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QPoint(1, 2)
+
class QPointFDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QPointF(1.1, 2.2)
+
class QDirDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QDir("./")
+
class QUuiCopy(DeepCopyHelper, unittest.TestCase):
@unittest.skipUnless(HAVE_Q, "QUuid is currently not supported on this platform.")
def setUp(self):
self.original = QUuid("67C8770B-44F1-410A-AB9A-F9B5446F13EE")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/deletelater_test.py b/sources/pyside6/tests/QtCore/deletelater_test.py
index 1d8dff895..96927780d 100644
--- a/sources/pyside6/tests/QtCore/deletelater_test.py
+++ b/sources/pyside6/tests/QtCore/deletelater_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QTimer, QCoreApplication, SIGNAL
from helper.usesqcoreapplication import UsesQCoreApplication
+
class TestDeleteLater(UsesQCoreApplication):
'''Test case for function DeleteLater'''
@@ -52,6 +53,7 @@ class TestDeleteLater(UsesQCoreApplication):
QTimer.singleShot(100, self.app.quit)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/destroysignal_test.py b/sources/pyside6/tests/QtCore/destroysignal_test.py
index fe91d5340..ff657a800 100644
--- a/sources/pyside6/tests/QtCore/destroysignal_test.py
+++ b/sources/pyside6/tests/QtCore/destroysignal_test.py
@@ -58,6 +58,7 @@ class TestDestroySignal(unittest.TestCase):
del p
self.assertTrue(self._destroyed)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/duck_punching_test.py b/sources/pyside6/tests/QtCore/duck_punching_test.py
index b6421b256..ab682026b 100644
--- a/sources/pyside6/tests/QtCore/duck_punching_test.py
+++ b/sources/pyside6/tests/QtCore/duck_punching_test.py
@@ -43,32 +43,36 @@ init_test_paths(False)
from PySide6.QtCore import QObject
from helper.usesqcoreapplication import UsesQCoreApplication
+
def MethodType(func, instance, instanceType):
return types.MethodType(func, instance)
+
class Duck(QObject):
def __init__(self):
super().__init__()
+
def childEvent(self, event):
QObject.childEvent(self, event)
+
class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication):
'''Test case for duck punching new implementations of C++ virtual methods into object instances.'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.duck_childEvent_called = False
UsesQCoreApplication.setUp(self)
def tearDown(self):
- #Release resources
+ # Release resources
del self.duck_childEvent_called
UsesQCoreApplication.tearDown(self)
-
def testChildEventMonkeyPatch(self):
- #Test if the new childEvent injected on QObject instance is called from C++
+ # Test if the new childEvent injected on QObject instance is called from C++
parent = QObject()
+
def childEvent(obj, event):
self.duck_childEvent_called = True
parent.childEvent = MethodType(childEvent, parent, QObject)
@@ -83,8 +87,9 @@ class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication):
parent.childEvent = None
def testChildEventMonkeyPatchWithInheritance(self):
- #Test if the new childEvent injected on a QObject's extension class instance is called from C++
+ # Test if the new childEvent injected on a QObject's extension class instance is called from C++
parent = Duck()
+
def childEvent(obj, event):
QObject.childEvent(obj, event)
self.duck_childEvent_called = True
@@ -101,6 +106,7 @@ class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication):
# assert that checks if the wrapper mapper is empty.
parent.childEvent = None
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/emoji_string_test.py b/sources/pyside6/tests/QtCore/emoji_string_test.py
index 4efb05e57..1c9f6e1ec 100644
--- a/sources/pyside6/tests/QtCore/emoji_string_test.py
+++ b/sources/pyside6/tests/QtCore/emoji_string_test.py
@@ -64,6 +64,7 @@ from PySide6.QtCore import QObject, Signal
emoji_str = u'\U0001f632' + u' ' # "😲 "
+
class TestStuff(QObject):
testsig = Signal(str)
@@ -82,6 +83,7 @@ class TestStuff(QObject):
# https://stackoverflow.com/questions/30775689/python-length-of-unicode-string-confusion
assert len(emoji_str) == 2 if sys.maxunicode > 0xffff else 3
+
if __name__ == "__main__":
mything = TestStuff()
mything.plausi()
diff --git a/sources/pyside6/tests/QtCore/errormessages_with_features_test.py b/sources/pyside6/tests/QtCore/errormessages_with_features_test.py
index 05670373f..72452a588 100644
--- a/sources/pyside6/tests/QtCore/errormessages_with_features_test.py
+++ b/sources/pyside6/tests/QtCore/errormessages_with_features_test.py
@@ -60,6 +60,7 @@ This test is in its own file because combining it with
"snake_prop_feature_test" gave strange interactions with the other tests.
"""
+
class ErrormessagesWithFeatures(unittest.TestCase):
probe = "called with wrong argument types"
probe_miss = "missing signature"
diff --git a/sources/pyside6/tests/QtCore/hash_test.py b/sources/pyside6/tests/QtCore/hash_test.py
index 71fb9cde9..a6aab9270 100644
--- a/sources/pyside6/tests/QtCore/hash_test.py
+++ b/sources/pyside6/tests/QtCore/hash_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtCore import QDate, QDateTime, QTime, QUrl
from PySide6.QtCore import QLine, QPoint, QRect, QSize
+
class HashTest(unittest.TestCase):
def testInsert(self):
myHash = {}
@@ -89,6 +90,7 @@ class HashTest(unittest.TestCase):
self.assertEqual(l1, l2)
self.assertEqual(hash(l1), hash(l2))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/inherits_test.py b/sources/pyside6/tests/QtCore/inherits_test.py
index a176cbd44..2beea6c17 100644
--- a/sources/pyside6/tests/QtCore/inherits_test.py
+++ b/sources/pyside6/tests/QtCore/inherits_test.py
@@ -37,9 +37,11 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class MyObject(QObject):
pass
+
class MainTest(unittest.TestCase):
def testInherits(self):
o = MyObject()
@@ -47,5 +49,6 @@ class MainTest(unittest.TestCase):
self.assertEqual(mo.className(), 'MyObject')
self.assertTrue(o.inherits('MyObject'))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/max_signals.py b/sources/pyside6/tests/QtCore/max_signals.py
index 2122aa738..b5b5f00d8 100644
--- a/sources/pyside6/tests/QtCore/max_signals.py
+++ b/sources/pyside6/tests/QtCore/max_signals.py
@@ -37,33 +37,37 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL
+
class MyObject(QObject):
pass
class TestSignalLimitless(unittest.TestCase):
SIGNAL_MAX = 100
+
def test100DynamicSignals(self):
self.count = 0
+
def onSignal():
self.count += 1
- #create 100 dynamic signals
+ # create 100 dynamic signals
o = MyObject()
for i in range(self.SIGNAL_MAX):
- o.connect(SIGNAL('sig%d()'%i), onSignal)
+ o.connect(SIGNAL(f'sig{i}()'), onSignal)
- #chek if the signals are valid
+ # check if the signals are valid
m = o.metaObject()
for i in range(self.SIGNAL_MAX):
- self.assertTrue(m.indexOfSignal('sig%d()'%i) > 0)
+ self.assertTrue(m.indexOfSignal(f'sig{i}()') > 0)
- #emit all 100 signals
+ # emit all 100 signals
for i in range(self.SIGNAL_MAX):
- o.emit(SIGNAL('sig%d()'%i))
+ o.emit(SIGNAL(f'sig{i}()'))
self.assertEqual(self.count, self.SIGNAL_MAX)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/missing_symbols_test.py b/sources/pyside6/tests/QtCore/missing_symbols_test.py
index a0ad4749c..8e03edf9c 100644
--- a/sources/pyside6/tests/QtCore/missing_symbols_test.py
+++ b/sources/pyside6/tests/QtCore/missing_symbols_test.py
@@ -39,13 +39,15 @@ init_test_paths(False)
from PySide6 import QtCore
+
class MissingClasses(unittest.TestCase):
- def testQSettings(self): # Bug 232
+ def testQSettings(self): # Bug 232
getattr(QtCore, 'QSettings')
- def testQtTrNoop(self): # Bug 220
+ def testQtTrNoop(self): # Bug 220
getattr(QtCore, 'QT_TR_NOOP')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/mockclass_test.py b/sources/pyside6/tests/QtCore/mockclass_test.py
index 51d980e74..887de6bca 100644
--- a/sources/pyside6/tests/QtCore/mockclass_test.py
+++ b/sources/pyside6/tests/QtCore/mockclass_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QCoreApplication
+
class Mock(object):
def __init__(self):
self.called = False
@@ -58,6 +59,7 @@ class MockClassTest(unittest.TestCase):
QCoreApplication.instance()
self.assertTrue(mock.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/multiple_feature_test.py b/sources/pyside6/tests/QtCore/multiple_feature_test.py
index 8517bb70f..0a66075ae 100644
--- a/sources/pyside6/tests/QtCore/multiple_feature_test.py
+++ b/sources/pyside6/tests/QtCore/multiple_feature_test.py
@@ -62,6 +62,7 @@ There is much more to come.
MethodDescriptorType = type(str.split)
+
class FeaturesTest(unittest.TestCase):
def testAllFeatureCombinations(self):
diff --git a/sources/pyside6/tests/QtCore/python_conversion.py b/sources/pyside6/tests/QtCore/python_conversion.py
index 451a54bac..1e081bac2 100644
--- a/sources/pyside6/tests/QtCore/python_conversion.py
+++ b/sources/pyside6/tests/QtCore/python_conversion.py
@@ -43,6 +43,7 @@ import datetime
from PySide6.QtCore import QTime, QDateTime, QDate
+
class TestDateTimeConversions (unittest.TestCase):
def testQDate(self):
date = datetime.date(2010, 4, 23)
@@ -59,7 +60,7 @@ class TestDateTimeConversions (unittest.TestCase):
self.assertEqual(time.hour, other.hour())
self.assertEqual(time.minute, other.minute())
self.assertEqual(time.second, other.second())
- self.assertEqual(time.microsecond/1000, other.msec())
+ self.assertEqual(time.microsecond / 1000, other.msec())
self.assertEqual(time, other.toPython())
@@ -76,7 +77,7 @@ class TestDateTimeConversions (unittest.TestCase):
self.assertEqual(dateTime.hour, otherTime.hour())
self.assertEqual(dateTime.minute, otherTime.minute())
self.assertEqual(dateTime.second, otherTime.second())
- self.assertEqual(dateTime.microsecond/1000, otherTime.msec())
+ self.assertEqual(dateTime.microsecond / 1000, otherTime.msec())
self.assertEqual(dateTime, other.toPython())
@@ -93,9 +94,10 @@ class TestDateTimeConversions (unittest.TestCase):
self.assertEqual(dateTime.hour, otherTime.hour())
self.assertEqual(dateTime.minute, otherTime.minute())
self.assertEqual(dateTime.second, otherTime.second())
- self.assertEqual(dateTime.microsecond/1000, otherTime.msec())
+ self.assertEqual(dateTime.microsecond / 1000, otherTime.msec())
self.assertEqual(dateTime, other.toPython())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qabs_test.py b/sources/pyside6/tests/QtCore/qabs_test.py
index 5dbcd6061..3320addb0 100644
--- a/sources/pyside6/tests/QtCore/qabs_test.py
+++ b/sources/pyside6/tests/QtCore/qabs_test.py
@@ -51,5 +51,6 @@ class QAbsTest(unittest.TestCase):
check(10.5)
check(-10.5)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py b/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py
index ed0873917..bffad74ec 100644
--- a/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py
+++ b/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py
@@ -51,7 +51,7 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
def testInternalPointer(self):
m = MyModel()
foo = QObject()
- idx = m.createIndex(0,0, foo)
+ idx = m.createIndex(0, 0, foo)
check = m.checkIndex(idx, QAbstractItemModel.CheckIndexOption.IndexIsValid
| QAbstractItemModel.CheckIndexOption.DoNotUseParent
| QAbstractItemModel.CheckIndexOption.ParentIsInvalid)
@@ -73,6 +73,7 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
proxyData = str(proxyModel.data(proxyIndex, Qt.DisplayRole))
self.assertEqual(sourceData, proxyData)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qanimationgroup_test.py b/sources/pyside6/tests/QtCore/qanimationgroup_test.py
index 57def6cb3..0e623de17 100644
--- a/sources/pyside6/tests/QtCore/qanimationgroup_test.py
+++ b/sources/pyside6/tests/QtCore/qanimationgroup_test.py
@@ -53,10 +53,11 @@ class QAnimationGroupTest(unittest.TestCase):
panim.clear()
- self.assertRaises(RuntimeError, lambda :sanim.parent())
+ self.assertRaises(RuntimeError, lambda: sanim.parent())
QTimer.singleShot(100, app.quit)
app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qbitarray_test.py b/sources/pyside6/tests/QtCore/qbitarray_test.py
index 1fee4f69c..580fa1f5b 100644
--- a/sources/pyside6/tests/QtCore/qbitarray_test.py
+++ b/sources/pyside6/tests/QtCore/qbitarray_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QBitArray
+
def bool_list_from_qbitarray(qbitarray):
'''This function is used instead of a list comprehension because
the QBitArray is being tested also to check if it is providing
@@ -51,11 +52,12 @@ def bool_list_from_qbitarray(qbitarray):
qbitarray_values.append(qbitarray.at(i))
return qbitarray_values
+
class QBitArrayIsIterableTest(unittest.TestCase):
'''Tests if QBitArray class is iterable and also '~' (__invert__) and bitwise operators'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.qbitarray = QBitArray(3)
self.qbitarray_values = [True, False, False]
# WARNING: do not pythonify the following loop
@@ -71,7 +73,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
self.other_qbitarray.setBit(i, self.other_qbitarray_values[i])
def tearDown(self):
- #Release resources
+ # Release resources
del self.qbitarray
del self.other_qbitarray
del self.qbitarray_values
@@ -79,7 +81,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
del self.inverted_qbitarray_values
def testQBitArrayIsIterable(self):
- #Tests if QBitArray class is iterable
+ # Tests if QBitArray class is iterable
qbitarray_is_iterable = True
try:
bitarray = [bit for bit in self.qbitarray]
@@ -88,7 +90,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
self.assertTrue(qbitarray_is_iterable)
def testQBitArrayInvertOperator(self):
- #Tests QBitArray '~' (__invert__) operator
+ # Tests QBitArray '~' (__invert__) operator
inverted_qbitarray = ~self.qbitarray
# WARNING: do not pythonify the following loop, the
# iterability of QBitArray class is tested in another place
@@ -96,7 +98,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
self.assertEqual(self.inverted_qbitarray_values, inverted_qbitarray_values)
def testQBitArrayOrBitwiseOperator(self):
- #Tests QBitArray '|' (or) operator
+ # Tests QBitArray '|' (or) operator
has_or_bitwise_operator = True
ored_qbitarray, ored_bool_list = None, None
try:
@@ -108,7 +110,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
self.assertEqual(bool_list_from_qbitarray(ored_qbitarray), ored_bool_list)
def testQBitArrayAndBitwiseOperator(self):
- #Tests QBitArray '&' (and) operator
+ # Tests QBitArray '&' (and) operator
has_and_bitwise_operator = True
anded_qbitarray, anded_bool_list = None, None
try:
@@ -120,7 +122,7 @@ class QBitArrayIsIterableTest(unittest.TestCase):
self.assertEqual(bool_list_from_qbitarray(anded_qbitarray), anded_bool_list)
def testQBitArrayXorBitwiseOperator(self):
- #Tests QBitArray '^' (xor) operator
+ # Tests QBitArray '^' (xor) operator
has_xor_bitwise_operator = True
xored_qbitarray, xored_bool_list = None, None
try:
diff --git a/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py b/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py
index dcc3a059b..9fdfda64e 100644
--- a/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py
+++ b/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py
@@ -47,20 +47,21 @@ class QByteArrayConcatenationOperatorTest(unittest.TestCase):
'''Test cases for QByteArray concatenation with '+' operator'''
def testConcatQByteArrayAndPythonString(self):
- #Test concatenation of a QByteArray with a Python bytes, in this order
+ # Test concatenation of a QByteArray with a Python bytes, in this order
qba = QByteArray(bytes('foo', "UTF-8"))
result = qba + bytes('\x00bar', "UTF-8")
self.assertEqual(type(result), QByteArray)
self.assertEqual(result, bytes('foo\x00bar', "UTF-8"))
def testConcatPythonStringAndQByteArray(self):
- #Test concatenation of a Python bytes with a QByteArray, in this order
+ # Test concatenation of a Python bytes with a QByteArray, in this order
concat_python_string_add_qbytearray_worked = True
qba = QByteArray(bytes('foo', "UTF-8"))
result = bytes('bar\x00', "UTF-8") + qba
self.assertEqual(type(result), QByteArray)
self.assertEqual(result, bytes('bar\x00foo', "UTF-8"))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py b/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py
index a65f76775..c7107872c 100644
--- a/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py
+++ b/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py
@@ -58,7 +58,7 @@ class BaseQByteArrayOperatorIAdd(object):
def testString(self):
'''QByteArray += bytes of size > 1'''
s = bytearray(bytes('dummy', "UTF-8"))
- self.obj += s # XXx iadd support abytearray
+ self.obj += s # XXx iadd support abytearray
self.assertEqual(self.obj, self.orig_obj + s)
self.assertEqual(self.obj.size(), self.orig_obj.size() + len(s))
@@ -90,5 +90,6 @@ class ValidQByteArrayOperatorIAdd(unittest.TestCase, BaseQByteArrayOperatorIAdd)
self.obj = QByteArray(bytes('some byte array', "UTF-8"))
self.orig_obj = QByteArray(bytes('some byte array', "UTF-8"))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qbytearray_operator_test.py b/sources/pyside6/tests/QtCore/qbytearray_operator_test.py
index 77678d199..0053b1351 100644
--- a/sources/pyside6/tests/QtCore/qbytearray_operator_test.py
+++ b/sources/pyside6/tests/QtCore/qbytearray_operator_test.py
@@ -42,30 +42,32 @@ init_test_paths(False)
from PySide6.QtCore import QByteArray
+
class QByteArrayOperatorEqual(unittest.TestCase):
'''TestCase for operator QByteArray == QByteArray'''
def testDefault(self):
- #QByteArray() == QByteArray()
+ # QByteArray() == QByteArray()
obj1 = QByteArray()
obj2 = QByteArray()
self.assertEqual(obj1, obj2)
def testSimple(self):
- #QByteArray(some_string) == QByteArray(some_string)
+ # QByteArray(some_string) == QByteArray(some_string)
string = bytes('egg snakes', "UTF-8")
self.assertEqual(QByteArray(string), QByteArray(string))
def testPyString(self):
- #QByteArray(string) == string
+ # QByteArray(string) == string
string = bytes('my test string', "UTF-8")
self.assertEqual(QByteArray(string), string)
+
class QByteArrayOperatorAt(unittest.TestCase):
'''TestCase for operator QByteArray[]'''
def testInRange(self):
- #QByteArray[x] where x is a valid index
+ # QByteArray[x] where x is a valid index
string = 'abcdefgh'
obj = QByteArray(bytes(string, "UTF-8"))
@@ -73,25 +75,25 @@ class QByteArrayOperatorAt(unittest.TestCase):
self.assertEqual(obj[i], bytes(string[i], "UTF-8"))
def testInRangeReverse(self):
- #QByteArray[x] where x is a valid index (reverse order)
+ # QByteArray[x] where x is a valid index (reverse order)
string = 'abcdefgh'
obj = QByteArray(bytes(string, "UTF-8"))
- for i in range(len(string)-1, 0, -1):
+ for i in range(len(string) - 1, 0, -1):
self.assertEqual(obj[i], bytes(string[i], "UTF-8"))
-
def testOutOfRange(self):
- #QByteArray[x] where x is out of index
+ # QByteArray[x] where x is out of index
string = bytes('1234567', "UTF-8")
obj = QByteArray(string)
- self.assertRaises(IndexError, lambda :obj[len(string)])
+ self.assertRaises(IndexError, lambda: obj[len(string)])
def testNullStrings(self):
ba = QByteArray(bytes('\x00', "UTF-8"))
self.assertEqual(ba.at(0), '\x00')
self.assertEqual(ba[0], bytes('\x00', "UTF-8"))
+
class QByteArrayOperatorLen(unittest.TestCase):
'''Test case for __len__ operator of QByteArray'''
diff --git a/sources/pyside6/tests/QtCore/qbytearray_test.py b/sources/pyside6/tests/QtCore/qbytearray_test.py
index 69e608d98..c347a6e4d 100644
--- a/sources/pyside6/tests/QtCore/qbytearray_test.py
+++ b/sources/pyside6/tests/QtCore/qbytearray_test.py
@@ -45,6 +45,7 @@ init_test_paths(False)
from PySide6.QtCore import QByteArray, QSettings, QObject, QDataStream, QIODevice
+
class QByteArrayTestToNumber(unittest.TestCase):
def testToNumberInt(self):
obj = QByteArray(bytes('37', "UTF8"))
@@ -95,10 +96,11 @@ class QByteArraySplit(unittest.TestCase):
'''Test case for QByteArray.split'''
def testPathSeparator(self):
- #QByteArray.split('/')
+ # QByteArray.split('/')
obj = QByteArray(bytes(unittest.__file__, "UTF8"))
self.assertEqual(obj.split('/'), unittest.__file__.split('/'))
+
class QByteArrayData(unittest.TestCase):
'''Test case for QByteArray.data'''
@@ -114,6 +116,7 @@ class QByteArrayData(unittest.TestCase):
self.assertEqual(s1, s2)
self.assertEqual(s1, ba)
+
class QByteArrayOperatorAtSetter(unittest.TestCase):
'''Test case for operator QByteArray[] - __setitem__'''
@@ -123,6 +126,7 @@ class QByteArrayOperatorAtSetter(unittest.TestCase):
obj[1] = bytes('0', "UTF8")
self.assertEqual(obj, QByteArray(bytes('103456', "UTF8")))
+
class QByteArrayOnQDataStream(unittest.TestCase):
'''
Bug PYSIDE-232
@@ -134,6 +138,7 @@ class QByteArrayOnQDataStream(unittest.TestCase):
# The __repr__ not suppose to crash anymore
self.assertNotEqual(repr(b), None)
+
class TestBug664(unittest.TestCase):
'''
QByteArray.data() should return correct data
@@ -148,6 +153,7 @@ class QByteArrayOnQVariant(unittest.TestCase):
a = QSettings().value("some_prop", QByteArray())
self.assertEqual(type(a), QByteArray)
+
class TestBug567(unittest.TestCase):
'''
QByteArray should support slices
@@ -171,12 +177,14 @@ class TestPickler(unittest.TestCase):
ba2 = pickle.loads(output)
self.assertEqual(str(ba), str(ba2))
+
class QByteArrayBug720(unittest.TestCase):
def testIt(self):
ba = QByteArray(bytes("32\"1\x00123", "UTF8"))
self.assertEqual(str(ba), str(bytes("32\"1\x00123", "UTF-8")))
self.assertEqual(repr(ba), "PySide6.QtCore.QByteArray(b'32\"1\\x00123')")
+
class QByteArrayImplicitConvert(unittest.TestCase):
def testString(self):
# No implicit conversions from QByteArray to python string
diff --git a/sources/pyside6/tests/QtCore/qcalendar_test.py b/sources/pyside6/tests/QtCore/qcalendar_test.py
index 0f9bfaf56..2c69a2026 100644
--- a/sources/pyside6/tests/QtCore/qcalendar_test.py
+++ b/sources/pyside6/tests/QtCore/qcalendar_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QCalendar
+
class TestQCalendar (unittest.TestCase):
def testCalendar(self):
calendar = QCalendar(QCalendar.System.Gregorian)
diff --git a/sources/pyside6/tests/QtCore/qcbor_test.py b/sources/pyside6/tests/QtCore/qcbor_test.py
index 06ba2d4d1..0df9d9f95 100644
--- a/sources/pyside6/tests/QtCore/qcbor_test.py
+++ b/sources/pyside6/tests/QtCore/qcbor_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import (QByteArray, QCborStreamReader, QCborStreamWriter,
QCborValue)
+
class TestCbor(unittest.TestCase):
def testReader(self):
ba = QByteArray()
@@ -62,7 +63,7 @@ class TestCbor(unittest.TestCase):
self.assertTrue(not ba.isEmpty())
reader = QCborStreamReader(ba)
self.assertTrue(reader.hasNext())
- if (reader.isByteArray()): # Python 2
+ if (reader.isByteArray()): # Python 2
value = reader.readByteArray()
self.assertTrue(value)
self.assertEqual(value.data, "hello")
@@ -77,5 +78,6 @@ class TestCbor(unittest.TestCase):
self.assertTrue(value.isString())
self.assertEqual(value.toString(), 'hello')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qcollator_test.py b/sources/pyside6/tests/QtCore/qcollator_test.py
index e5f2958d4..b9fc29658 100644
--- a/sources/pyside6/tests/QtCore/qcollator_test.py
+++ b/sources/pyside6/tests/QtCore/qcollator_test.py
@@ -64,5 +64,6 @@ class QCollatorTest(unittest.TestCase):
self.assertEqual(c.ignorePunctuation(), True)
self.assertEqual(c.locale(), QLocale(QLocale.NorwegianBokmal))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qcommandlineparser_test.py b/sources/pyside6/tests/QtCore/qcommandlineparser_test.py
index 12250669a..8021aad74 100644
--- a/sources/pyside6/tests/QtCore/qcommandlineparser_test.py
+++ b/sources/pyside6/tests/QtCore/qcommandlineparser_test.py
@@ -59,5 +59,6 @@ class QCommandLineParserTest(unittest.TestCase):
self.assertEqual(parser2.values("b"), [])
self.assertEqual(parser2.positionalArguments(), [])
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py b/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py
index f3f4bfd8c..8e89a260e 100644
--- a/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py
+++ b/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py
@@ -42,15 +42,17 @@ init_test_paths(False)
from PySide6.QtCore import QCoreApplication
+
class QCoreApplicationInstanceTest(unittest.TestCase):
'''Test cases for QCoreApplication.instance static method'''
def testQCoreApplicationInstance(self):
- #Tests QCoreApplication.instance()
+ # Tests QCoreApplication.instance()
self.assertEqual(QCoreApplication.instance(), None)
app = QCoreApplication([])
self.assertEqual(QCoreApplication.instance(), app)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qcoreapplication_test.py b/sources/pyside6/tests/QtCore/qcoreapplication_test.py
index 8809c2a8e..30e000c31 100644
--- a/sources/pyside6/tests/QtCore/qcoreapplication_test.py
+++ b/sources/pyside6/tests/QtCore/qcoreapplication_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QCoreApplication
+
class TestQCoreApplication(unittest.TestCase):
def testNoArguments(self):
app = QCoreApplication()
diff --git a/sources/pyside6/tests/QtCore/qdatastream_test.py b/sources/pyside6/tests/QtCore/qdatastream_test.py
index fd1dcfd46..cd0e3e0cb 100644
--- a/sources/pyside6/tests/QtCore/qdatastream_test.py
+++ b/sources/pyside6/tests/QtCore/qdatastream_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QBitArray, QByteArray, QIODevice, QDataStream, QDate, QTime, QDateTime
+
def create_bitarray(string):
array = QBitArray(len(string))
for i, char in enumerate(string):
@@ -109,6 +110,7 @@ class QDataStreamWrite(unittest.TestCase):
y = int(self.read.readUInt32())
self.assertEqual(x, y)
+
class QDataStreamShift(unittest.TestCase):
'''Test case for << and >> operators'''
@@ -223,7 +225,6 @@ class QDataStreamShift(unittest.TestCase):
self.assertTrue(res.isValid())
self.assertFalse(res.isNull())
-
def testQTimeNull(self):
'''QDataStream <<>> QTime - null'''
self.stream << QTime()
@@ -320,6 +321,7 @@ class QDataStreamRawData(unittest.TestCase):
data = QDataStream(ba)
self.assertEqual(data.readRawData(4), bytes('AB\x00C', "UTF-8"))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qdate_test.py b/sources/pyside6/tests/QtCore/qdate_test.py
index 2946dc9b4..b5259163a 100644
--- a/sources/pyside6/tests/QtCore/qdate_test.py
+++ b/sources/pyside6/tests/QtCore/qdate_test.py
@@ -66,5 +66,6 @@ class TestQDate (unittest.TestCase):
nodate = QDate()
self.assertFalse(nodate)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qdatetime_test.py b/sources/pyside6/tests/QtCore/qdatetime_test.py
index 5342f40b0..362b1fb4c 100644
--- a/sources/pyside6/tests/QtCore/qdatetime_test.py
+++ b/sources/pyside6/tests/QtCore/qdatetime_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QDateTime, QDate, QTime
+
class TestQDate (unittest.TestCase):
def testDateConversion(self):
dateTime = QDateTime(QDate(2011, 5, 17), QTime(11, 1, 14, 15))
@@ -54,5 +55,6 @@ class TestQDate (unittest.TestCase):
qt = QDateTime(py)
self.assertEqual(qt, py)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qeasingcurve_test.py b/sources/pyside6/tests/QtCore/qeasingcurve_test.py
index 4966b207c..46f8f5b90 100644
--- a/sources/pyside6/tests/QtCore/qeasingcurve_test.py
+++ b/sources/pyside6/tests/QtCore/qeasingcurve_test.py
@@ -37,12 +37,14 @@ init_test_paths(False)
from PySide6.QtCore import QEasingCurve
+
def myFunction(progress):
if progress == 1.0:
return 100.0
else:
return -100.0
+
class TestQEasingCurve(unittest.TestCase):
def testCustomType(self):
ec = QEasingCurve()
@@ -57,5 +59,6 @@ class TestQEasingCurve(unittest.TestCase):
self.assertEqual(ec.valueForProgress(1.0), 100.0)
self.assertEqual(ec.valueForProgress(0.5), -100.0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qenum_test.py b/sources/pyside6/tests/QtCore/qenum_test.py
index 146773094..0d524505a 100644
--- a/sources/pyside6/tests/QtCore/qenum_test.py
+++ b/sources/pyside6/tests/QtCore/qenum_test.py
@@ -142,6 +142,7 @@ class TestEnumPickling(unittest.TestCase):
# PYSIDE-957: The QEnum macro
+
try:
import enum
HAVE_ENUM = True
@@ -149,7 +150,9 @@ except ImportError:
HAVE_ENUM = False
QEnum = QFlag = lambda x: x
import types
- class Enum: pass
+
+ class Enum:
+ pass
enum = types.ModuleType("enum")
enum.Enum = enum.Flag = enum.IntEnum = enum.IntFlag = Enum
Enum.__module__ = "enum"
@@ -159,11 +162,13 @@ except ImportError:
HAVE_FLAG = hasattr(enum, "Flag")
+
@QEnum
class OuterEnum(enum.Enum):
A = 1
B = 2
+
class SomeClass(QObject):
@QEnum
diff --git a/sources/pyside6/tests/QtCore/qevent_test.py b/sources/pyside6/tests/QtCore/qevent_test.py
index 8251c5814..2d7aff03f 100644
--- a/sources/pyside6/tests/QtCore/qevent_test.py
+++ b/sources/pyside6/tests/QtCore/qevent_test.py
@@ -41,11 +41,12 @@ init_test_paths(False)
from PySide6.QtCore import QEvent
+
class QEventTypeFlag(unittest.TestCase):
'''Test case for usage of QEvent.Type flags'''
def testFlagAccess(self):
- #QEvent.Type flags usage
+ # QEvent.Type flags usage
event = QEvent(QEvent.Timer)
self.assertEqual(event.type(), QEvent.Timer)
@@ -56,5 +57,6 @@ class QEventTypeFlag(unittest.TestCase):
event = QEvent(QEvent.IconTextChange)
self.assertEqual(event.type(), QEvent.IconTextChange)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qfile_test.py b/sources/pyside6/tests/QtCore/qfile_test.py
index d00ac72a7..897b4583c 100644
--- a/sources/pyside6/tests/QtCore/qfile_test.py
+++ b/sources/pyside6/tests/QtCore/qfile_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QDir, QFile, QIODevice, QSaveFile, QTemporaryDir
+
class GetCharTest(unittest.TestCase):
'''Test case for QIODevice.getChar in QFile'''
@@ -84,5 +85,6 @@ class GetCharTest(unittest.TestCase):
self.assertTrue(saveFile.commit())
self.assertTrue(os.path.exists(QDir.toNativeSeparators(saveFile.fileName())))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qfileinfo_test.py b/sources/pyside6/tests/QtCore/qfileinfo_test.py
index 3049a8fc1..bbdd4bce9 100644
--- a/sources/pyside6/tests/QtCore/qfileinfo_test.py
+++ b/sources/pyside6/tests/QtCore/qfileinfo_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QFile, QFileInfo
+
class QFileConstructor(unittest.TestCase):
'''QFileInfo constructor with qfile'''
@@ -45,5 +46,6 @@ class QFileConstructor(unittest.TestCase):
'''QFileInfo(QFile)'''
obj = QFileInfo(QFile())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qfileread_test.py b/sources/pyside6/tests/QtCore/qfileread_test.py
index 0e4e670e5..98b27896c 100644
--- a/sources/pyside6/tests/QtCore/qfileread_test.py
+++ b/sources/pyside6/tests/QtCore/qfileread_test.py
@@ -41,12 +41,15 @@ from PySide6.QtCore import QIODevice, QTemporaryFile
class FileChild1(QTemporaryFile):
pass
+
class FileChild2(QTemporaryFile):
def readData(self, maxlen):
return super(FileChild2, self).readData(maxlen)
+
def readLineData(self, maxlen):
return super(FileChild2, self).readLineData(maxlen)
+
class readDataTest(unittest.TestCase):
'''Test case for readData and readLineData'''
@@ -70,7 +73,6 @@ class readDataTest(unittest.TestCase):
s1 = self.filename1.read(50)
self.assertEqual(s1, 'Test text for testing')
-
def testBug40(self):
self.filename2.seek(0)
s2 = self.filename2.read(50)
@@ -84,5 +86,6 @@ class readDataTest(unittest.TestCase):
s1 = self.filename1.read(50)
self.assertEqual(s1, s2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qflags_test.py b/sources/pyside6/tests/QtCore/qflags_test.py
index 4b368681f..bde6abde1 100644
--- a/sources/pyside6/tests/QtCore/qflags_test.py
+++ b/sources/pyside6/tests/QtCore/qflags_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import Qt, QTemporaryFile, QFile, QIODevice, QObject
+
class QFlagTest(unittest.TestCase):
'''Test case for usage of flags'''
@@ -110,12 +111,14 @@ class QFlagOperatorTest(unittest.TestCase):
flags = Qt.NoItemFlags | Qt.ItemIsUserCheckable
self.assertEqual(flags | Qt.ItemIsEnabled, Qt.ItemIsEnabled | flags)
+
class QFlagsOnQVariant(unittest.TestCase):
def testQFlagsOnQVariant(self):
o = QObject()
o.setProperty("foo", QIODevice.ReadOnly | QIODevice.WriteOnly)
self.assertEqual(type(o.property("foo")), QIODevice.OpenMode)
+
class QFlagsWrongType(unittest.TestCase):
def testWrongType(self):
'''Wrong type passed to QFlags binary operators'''
diff --git a/sources/pyside6/tests/QtCore/qhandle_test.py b/sources/pyside6/tests/QtCore/qhandle_test.py
index 08e53633c..9f6708787 100644
--- a/sources/pyside6/tests/QtCore/qhandle_test.py
+++ b/sources/pyside6/tests/QtCore/qhandle_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QThread, Qt
+
class TestHANDLE(unittest.TestCase):
def testIntConversion(self):
i = 0
@@ -48,5 +49,6 @@ class TestHANDLE(unittest.TestCase):
i = 0 + int(h)
self.assertEqual(i, int(h))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py b/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py
index 3f8e11a4b..7043ec7d7 100644
--- a/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py
+++ b/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py
@@ -43,13 +43,16 @@ from PySide6.QtCore import (QLibraryInfo, QtCriticalMsg, QtDebugMsg, QtWarningMs
param = []
+
def handler(msgt, ctx, msg):
global param
param = [msgt, ctx, msg.strip()]
+
def handleruseless(msgt, ctx, msg):
pass
+
class QInstallMsgHandlerTest(unittest.TestCase):
def tearDown(self):
@@ -84,6 +87,7 @@ class QInstallMsgHandlerTest(unittest.TestCase):
self.assertEqual(param[0], QtCriticalMsg)
self.assertEqual(param[2], "Test Critical")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qlinef_test.py b/sources/pyside6/tests/QtCore/qlinef_test.py
index cd278f5f9..0a2e91a82 100644
--- a/sources/pyside6/tests/QtCore/qlinef_test.py
+++ b/sources/pyside6/tests/QtCore/qlinef_test.py
@@ -52,5 +52,6 @@ class TestQLineF (unittest.TestCase):
self.assertEqual(QLineF.BoundedIntersection, value)
self.assertEqual(QPointF(1, 0), p)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qlocale_test.py b/sources/pyside6/tests/QtCore/qlocale_test.py
index d2ba4bf5e..0e1603846 100644
--- a/sources/pyside6/tests/QtCore/qlocale_test.py
+++ b/sources/pyside6/tests/QtCore/qlocale_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QLocale
+
class QLocaleTestToNumber(unittest.TestCase):
def testToNumberInt(self):
obj = QLocale(QLocale.C)
@@ -71,5 +72,6 @@ class QLocaleTestToNumber(unittest.TestCase):
obj = QLocale(QLocale.C)
self.assertTrue(not obj.toULongLong('-37')[1])
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qlockfile_test.py b/sources/pyside6/tests/QtCore/qlockfile_test.py
index 2508b3f7b..f773c7112 100644
--- a/sources/pyside6/tests/QtCore/qlockfile_test.py
+++ b/sources/pyside6/tests/QtCore/qlockfile_test.py
@@ -42,6 +42,7 @@ init_test_paths()
from PySide6.QtCore import QDir, QLockFile, QCoreApplication
+
class TestQMessageAuthenticationCode (unittest.TestCase):
def setUp(self):
@@ -59,5 +60,6 @@ class TestQMessageAuthenticationCode (unittest.TestCase):
self.assertTrue(lockFile.isLocked())
lockFile.unlock()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py b/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py
index d312fe412..89e3d7ba1 100644
--- a/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py
+++ b/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QCryptographicHash, QMessageAuthenticationCode
+
class TestQMessageAuthenticationCode (unittest.TestCase):
def test(self):
code = QMessageAuthenticationCode(QCryptographicHash.Sha1, bytes('bla', "UTF-8"))
@@ -48,5 +49,6 @@ class TestQMessageAuthenticationCode (unittest.TestCase):
self.assertTrue(result.size() > 0)
print(result.toHex())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qmetaobject_test.py b/sources/pyside6/tests/QtCore/qmetaobject_test.py
index abff32037..33c35595f 100644
--- a/sources/pyside6/tests/QtCore/qmetaobject_test.py
+++ b/sources/pyside6/tests/QtCore/qmetaobject_test.py
@@ -44,12 +44,14 @@ from PySide6.QtCore import QFile, QObject, QTimer, SIGNAL
class Foo(QFile):
- pass
+ pass
+
class DynObject(QObject):
def slot(self):
pass
+
class qmetaobject_test(unittest.TestCase):
"""
def test_QMetaObject(self):
@@ -93,6 +95,7 @@ class qmetaobject_test(unittest.TestCase):
self.assertEqual(timer.metaObject().superClass().className(),
"QObject")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qmimedatabase_test.py b/sources/pyside6/tests/QtCore/qmimedatabase_test.py
index ee16142e0..099f9e10e 100644
--- a/sources/pyside6/tests/QtCore/qmimedatabase_test.py
+++ b/sources/pyside6/tests/QtCore/qmimedatabase_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QMimeDatabase, QLocale
+
class QMimeDatabaseTest(unittest.TestCase):
def testMimeTypeForName(self):
db = QMimeDatabase()
@@ -81,5 +82,6 @@ class QMimeDatabaseTest(unittest.TestCase):
doesNotExist = db.mimeTypeForName("foobar/x-doesnot-exist")
self.assertTrue(not doesNotExist.isValid())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py b/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
index 953c57c77..70ca5b9a6 100644
--- a/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
+++ b/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
@@ -45,41 +45,42 @@ from PySide6.QtCore import QAbstractListModel, QObject
class MyModel (QAbstractListModel):
pass
+
class TestQModelIndexInternalPointer(unittest.TestCase):
''' Test case for QAbstractListModel.createIndex and QModelIndex.internalPointer'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.model = MyModel()
def tearDown(self):
- #Release resources
+ # Release resources
del self.model
def testInternalPointer(self):
- #Test QAbstractListModel.createIndex and
- #QModelIndex.internalPointer with regular Python objects
+ # Test QAbstractListModel.createIndex and
+ # QModelIndex.internalPointer with regular Python objects
obj = QObject()
idx = self.model.createIndex(0, 0, "Hello")
i = idx.internalPointer()
self.assertEqual(i, "Hello")
def testReferenceCounting(self):
- #Test reference counting when retrieving data with
- #QModelIndex.internalPointer
+ # Test reference counting when retrieving data with
+ # QModelIndex.internalPointer
o = [1, 2, 3]
o_refcnt = sys.getrefcount(o)
idx = self.model.createIndex(0, 0, o)
ptr = idx.internalPointer()
self.assertEqual(sys.getrefcount(o), o_refcnt + 1)
-
def testIndexForDefaultDataArg(self):
- #Test QAbstractListModel.createIndex with a default
- #value for data argument
+ # Test QAbstractListModel.createIndex with a default
+ # value for data argument
idx = self.model.createIndex(0, 0)
self.assertEqual(None, idx.internalPointer())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py b/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py
index f1d7fff1c..cab045ddc 100644
--- a/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py
@@ -39,11 +39,12 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QCoreApplication
+
class ChildrenCoreApplication(unittest.TestCase):
'''Test case for calling QObject.children after creating a QCoreApp'''
def testQCoreAppChildren(self):
- #QObject.children() after creating a QCoreApplication
+ # QObject.children() after creating a QCoreApplication
# Minimal test:
# 1- Create QCoreApp
# 2- Create parent and childrens
@@ -55,7 +56,7 @@ class ChildrenCoreApplication(unittest.TestCase):
# Uncomment the lines below to make the test pass
# del children
# del child2
- del parent # XXX Segfaults here
+ del parent # XXX Segfaults here
self.assertTrue(True)
diff --git a/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py b/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py
index 794eddd13..a5b44a2a1 100644
--- a/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py
@@ -46,6 +46,7 @@ from helper.usesqcoreapplication import UsesQCoreApplication
def cute_slot():
pass
+
class Obj(QObject):
def __init__(self):
super().__init__()
@@ -64,6 +65,7 @@ class Obj(QObject):
self.con_notified = False
self.dis_notified = False
+
class TestQObjectConnectNotify(UsesQCoreApplication):
'''Test case for QObject::connectNotify'''
def setUp(self):
@@ -109,5 +111,6 @@ class TestQObjectConnectNotify(UsesQCoreApplication):
sender.disconnect(SIGNAL("foo()"), cute_slot)
self.assertTrue(sender.dis_notified)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_destructor.py b/sources/pyside6/tests/QtCore/qobject_destructor.py
index 2354cdfa7..d24017397 100644
--- a/sources/pyside6/tests/QtCore/qobject_destructor.py
+++ b/sources/pyside6/tests/QtCore/qobject_destructor.py
@@ -43,6 +43,7 @@ class MyObject(QObject):
super().__init__(None)
self._o = other
+
class TestDestructor(unittest.TestCase):
def testReference(self):
o = QObject()
@@ -51,5 +52,6 @@ class TestDestructor(unittest.TestCase):
del m
self.assertEqual(sys.getrefcount(o), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_event_filter_test.py b/sources/pyside6/tests/QtCore/qobject_event_filter_test.py
index 112f21103..c45ba1c73 100644
--- a/sources/pyside6/tests/QtCore/qobject_event_filter_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_event_filter_test.py
@@ -42,10 +42,11 @@ from PySide6.QtCore import QObject, QTimerEvent
from helper.usesqcoreapplication import UsesQCoreApplication
+
class FilterObject(QObject):
'''Filter object for the basic test'''
def __init__(self, obj=None, event_type=None, *args):
- #Creates a new filter object
+ # Creates a new filter object
QObject.__init__(self, *args)
self.obj = obj
self.event_type = event_type
@@ -53,7 +54,7 @@ class FilterObject(QObject):
self.events_bypassed = 0
def setTargetObject(self, obj):
- #Sets the object that will be filtered
+ # Sets the object that will be filtered
self.obj = obj
def eventFilter(self, obj, event):
@@ -70,6 +71,7 @@ class FilterObject(QObject):
else:
return QObject.eventFilter(self, obj, event)
+
class FilteredObject(QObject):
'''Class that will be filtered. Quits the app after 5 timer events'''
def __init__(self, app, *args):
@@ -78,28 +80,30 @@ class FilteredObject(QObject):
self.times_called = 0
def timerEvent(self, evt):
- #Overriden method
+ # Overridden method
self.times_called += 1
if self.times_called == 5:
self.app.quit()
+
class TestQObjectEventFilterPython(UsesQCoreApplication):
'''QObject.eventFilter - Reimplemented in python
Filters 5 TimerEvents and then bypasses the other events to the
timerEvent method. After 5 runs, the timerEvent method will ask
the core application to exit'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
UsesQCoreApplication.setUp(self)
self.obj_filter = FilterObject(event_type=QTimerEvent)
+
def tearDown(self):
- #Release resources
+ # Release resources
del self.obj_filter
UsesQCoreApplication.tearDown(self)
def testEventFilter(self):
- #QObject.eventFilter reimplemented in python
+ # QObject.eventFilter reimplemented in python
filtered = FilteredObject(self.app)
filtered.installEventFilter(self.obj_filter)
self.obj_filter.setTargetObject(filtered)
@@ -145,5 +149,6 @@ class TestQObjectEventFilterPython(UsesQCoreApplication):
del obj
self.assertEqual(wref(), None)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_inherits_test.py b/sources/pyside6/tests/QtCore/qobject_inherits_test.py
index 252b3e024..3246f0b77 100644
--- a/sources/pyside6/tests/QtCore/qobject_inherits_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_inherits_test.py
@@ -42,19 +42,20 @@ from PySide6.QtWidgets import QApplication, QLabel, QVBoxLayout
is_alive = None
+
class InheritsCase(unittest.TestCase):
'''Test case for QObject.inherits'''
def testCppInheritance(self):
- #QObject.inherits() for c++ classes
- #An class inherits itself
+ # QObject.inherits() for c++ classes
+ # A class inherits itself
self.assertTrue(QObject().inherits('QObject'))
def testPythonInheritance(self):
- #QObject.inherits() for python classes
+ # QObject.inherits() for python classes
class Dummy(QObject):
- #Dummy class
+ # Dummy class
pass
self.assertTrue(Dummy().inherits('QObject'))
@@ -62,15 +63,16 @@ class InheritsCase(unittest.TestCase):
self.assertTrue(not Dummy().inherits('FooBar'))
def testPythonMultiInheritance(self):
- #QObject.inherits() for multiple inheritance
+ # QObject.inherits() for multiple inheritance
# QObject.inherits(classname) should fail if classname isn't a
# QObject subclass
class Parent(object):
- #Dummy parent
+ # Dummy parent
pass
+
class Dummy(QObject, Parent):
- #Dummy class
+ # Dummy class
pass
self.assertTrue(Dummy().inherits('QObject'))
@@ -108,6 +110,7 @@ class InheritsCase(unittest.TestCase):
# is null under the pythonTypeIsValueType() method in shiboken.
def testDeleteMultipleInheritance(self):
app = QApplication(sys.argv)
+
class DerivedLabel(QLabel, QObject):
def __del__(self):
global is_alive
diff --git a/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py b/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py
index f799a96d0..9143355f2 100644
--- a/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py
@@ -44,6 +44,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class ExtQObject(QObject):
def __init__(self):
# "foobar" will become a object attribute that will not be
@@ -55,12 +56,14 @@ class ExtQObject(QObject):
# definition of "self.foobar".
super().__init__()
+
class TestBug378(unittest.TestCase):
'''Test case for the bug #378'''
def testBug378(self):
obj = ExtQObject()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_parent_test.py b/sources/pyside6/tests/QtCore/qobject_parent_test.py
index 0cef3d326..972d4f6fa 100644
--- a/sources/pyside6/tests/QtCore/qobject_parent_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_parent_test.py
@@ -45,17 +45,17 @@ class ParentRefCountCase(unittest.TestCase):
'''Test case for the refcount changes of setParent'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.parent = QObject()
self.child = QObject()
def tearDown(self):
- #Release resources
+ # Release resources
del self.child
del self.parent
def testSetParent(self):
- #QObject.setParent() refcount changes
+ # QObject.setParent() refcount changes
self.assertEqual(getrefcount(self.child), 2)
self.child.setParent(self.parent)
self.assertEqual(getrefcount(self.child), 3)
@@ -68,15 +68,16 @@ class ParentRefCountCase(unittest.TestCase):
self.assertEqual(getrefcount(self.child), 3)
def testConstructor(self):
- #QObject(QObject) refcount changes
+ # QObject(QObject) refcount changes
child = QObject(self.parent)
self.assertEqual(getrefcount(child), 3)
+
class ParentCase(unittest.TestCase):
'''Small collection of tests related to parent-child relationship'''
def testSetParent(self):
- #QObject.setParent()
+ # QObject.setParent()
parent = QObject()
child = QObject()
child.setParent(parent)
@@ -84,7 +85,7 @@ class ParentCase(unittest.TestCase):
self.assertEqual(parent, child.parent())
def testParentConstructor(self):
- #QObject(parent)
+ # QObject(parent)
parent = QObject()
child = QObject(parent)
@@ -95,14 +96,14 @@ class ParentCase(unittest.TestCase):
self.assertEqual(orig_repr, repr(parent.children()[0]))
def testChildren(self):
- #QObject.children()
+ # QObject.children()
parent = QObject()
children = [QObject(parent) for x in range(25)]
self.assertEqual(parent.children(), children)
def testFindChild(self):
- #QObject.findChild() with all QObject
+ # QObject.findChild() with all QObject
parent = QObject()
children = [QObject(parent) for i in range(20)]
@@ -123,7 +124,7 @@ class ParentCase(unittest.TestCase):
self.assertTrue(isinstance(child, QObject))
def testFindChildren(self):
- #QObject.findChildren() with all QObject
+ # QObject.findChildren() with all QObject
parent = QObject()
target_name = 'foo'
children = [QTimer(parent) for i in range(20)]
@@ -149,7 +150,7 @@ class ParentCase(unittest.TestCase):
self.assertEqual(res, test_children)
def testParentEquality(self):
- #QObject.parent() == parent
+ # QObject.parent() == parent
parent = QObject()
child = QObject(parent)
self.assertEqual(parent, child.parent())
@@ -170,7 +171,7 @@ class TestParentOwnership(unittest.TestCase):
self.assertEqual(getrefcount(child), 2)
# this will fail because parent deleted child cpp object
- self.assertRaises(RuntimeError, lambda :child.objectName())
+ self.assertRaises(RuntimeError, lambda: child.objectName())
# test parent with multiples children
def testMultipleChildren(self):
@@ -191,8 +192,8 @@ class TestParentOwnership(unittest.TestCase):
self.assertEqual(getrefcount(c2), 2)
# this will fail because parent deleted child cpp object
- self.assertRaises(RuntimeError, lambda :c.objectName())
- self.assertRaises(RuntimeError, lambda :c2.objectName())
+ self.assertRaises(RuntimeError, lambda: c.objectName())
+ self.assertRaises(RuntimeError, lambda: c2.objectName())
# test recursive parent
def testRecursiveParent(self):
@@ -213,8 +214,8 @@ class TestParentOwnership(unittest.TestCase):
self.assertEqual(getrefcount(c2), 2)
# this will fail because parent deleted child cpp object
- self.assertRaises(RuntimeError, lambda :c.objectName())
- self.assertRaises(RuntimeError, lambda :c2.objectName())
+ self.assertRaises(RuntimeError, lambda: c.objectName())
+ self.assertRaises(RuntimeError, lambda: c2.objectName())
# test parent transfer
def testParentTransfer(self):
@@ -238,6 +239,7 @@ class ExtQObject(QObject):
def __init__(self):
super().__init__()
+
class ReparentingTest(unittest.TestCase):
'''Test cases for reparenting'''
diff --git a/sources/pyside6/tests/QtCore/qobject_property_test.py b/sources/pyside6/tests/QtCore/qobject_property_test.py
index 7abe3ede0..d141a97df 100644
--- a/sources/pyside6/tests/QtCore/qobject_property_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_property_test.py
@@ -39,6 +39,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Property, Signal
+
class MyObjectWithNotifyProperty(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
@@ -54,6 +55,7 @@ class MyObjectWithNotifyProperty(QObject):
notifyP = Signal()
myProperty = Property(int, readP, fset=writeP, notify=notifyP)
+
class PropertyWithNotify(unittest.TestCase):
def called(self):
self.called_ = True
diff --git a/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py b/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py
index baa62ac1e..e9f935482 100644
--- a/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py
@@ -41,19 +41,21 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QThread, SIGNAL
+
class Dummy(QObject):
'''Dummy class'''
pass
+
class QObjectReceivers(unittest.TestCase):
'''Test case for QObject.receivers()'''
def cb(self, *args):
- #Dummy callback
+ # Dummy callback
pass
def testQObjectReceiversExtern(self):
- #QObject.receivers() - Protected method external access
+ # QObject.receivers() - Protected method external access
obj = Dummy()
self.assertEqual(obj.receivers(SIGNAL("destroyed()")), 0)
@@ -62,7 +64,7 @@ class QObjectReceivers(unittest.TestCase):
self.assertEqual(obj.receivers(SIGNAL("destroyed()")), 1)
def testQThreadReceiversExtern(self):
- #QThread.receivers() - Inherited protected method
+ # QThread.receivers() - Inherited protected method
obj = QThread()
self.assertEqual(obj.receivers(SIGNAL('destroyed()')), 0)
diff --git a/sources/pyside6/tests/QtCore/qobject_test.py b/sources/pyside6/tests/QtCore/qobject_test.py
index d452e828e..3abbe1b44 100644
--- a/sources/pyside6/tests/QtCore/qobject_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_test.py
@@ -42,16 +42,19 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Signal, Qt
+
class Obj(QObject):
signal = Signal()
+
def empty(self):
pass
+
class ObjectNameCase(unittest.TestCase):
'''Tests related to QObject object name'''
def testSimple(self):
- #QObject.objectName(string)
+ # QObject.objectName(string)
name = 'object1'
obj = QObject()
obj.setObjectName(name)
@@ -59,7 +62,7 @@ class ObjectNameCase(unittest.TestCase):
self.assertEqual(name, obj.objectName())
def testEmpty(self):
- #QObject.objectName('')
+ # QObject.objectName('')
name = ''
obj = QObject()
obj.setObjectName(name)
@@ -67,13 +70,13 @@ class ObjectNameCase(unittest.TestCase):
self.assertEqual(name, obj.objectName())
def testDefault(self):
- #QObject.objectName() default
+ # QObject.objectName() default
obj = QObject()
self.assertEqual('', obj.objectName())
def testUnicode(self):
name = 'não'
- #FIXME Strange error on upstream when using equal(name, obj)
+ # FIXME Strange error on upstream when using equal(name, obj)
obj = QObject()
obj.setObjectName(name)
self.assertEqual(obj.objectName(), name)
@@ -85,5 +88,6 @@ class ObjectNameCase(unittest.TestCase):
self.assertTrue(obj.signal.connect(obj.empty, Qt.UniqueConnection))
self.assertFalse(obj.signal.connect(obj.empty, Qt.UniqueConnection))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_timer_event_test.py b/sources/pyside6/tests/QtCore/qobject_timer_event_test.py
index 0730dd1f0..8a7f4da7b 100644
--- a/sources/pyside6/tests/QtCore/qobject_timer_event_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_timer_event_test.py
@@ -43,6 +43,7 @@ from PySide6.QtCore import QObject, QCoreApplication
from helper.usesqcoreapplication import UsesQCoreApplication
+
class Dummy(QObject):
def __init__(self, app):
@@ -58,23 +59,25 @@ class Dummy(QObject):
if self.times_called == 5:
self.app.exit(0)
+
class QObjectTimerEvent(UsesQCoreApplication):
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(QObjectTimerEvent, self).setUp()
def tearDown(self):
- #Release resources
+ # Release resources
super(QObjectTimerEvent, self).tearDown()
def testTimerEvent(self):
- #QObject.timerEvent overloading
+ # QObject.timerEvent overloading
obj = Dummy(self.app)
timer_id = obj.startTimer(200)
self.app.exec_()
obj.killTimer(timer_id)
self.assertEqual(obj.times_called, 5)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py b/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py
index 4647a2c4b..796fc93a2 100644
--- a/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py
@@ -45,6 +45,7 @@ from PySide6.QtCore import QObject
#from helper.usesqcoreapplication import UsesQCoreApplication
+
class QObjectTrTest(unittest.TestCase):
'''Test case to check if QObject tr static methods could be treated as instance methods.'''
@@ -55,7 +56,7 @@ class QObjectTrTest(unittest.TestCase):
del self.obj
def testTrCommonCase(self):
- #Test common case for QObject.tr
+ # Test common case for QObject.tr
invar1 = 'test1'
outvar1 = self.obj.tr(invar1)
invar2 = 'test2'
@@ -63,13 +64,14 @@ class QObjectTrTest(unittest.TestCase):
self.assertEqual((invar1, invar2), (outvar1, outvar2))
def testTrAsInstanceMethod(self):
- #Test QObject.tr as instance
+ # Test QObject.tr as instance
invar1 = 'test1'
outvar1 = QObject.tr(self.obj, invar1)
invar2 = 'test2'
outvar2 = QObject.tr(self.obj, invar2, 'test comment')
self.assertEqual((invar1, invar2), (outvar1, outvar2))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py b/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py
index 0b336ca01..e7c784300 100644
--- a/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py
+++ b/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py
@@ -37,11 +37,13 @@ init_test_paths(False)
from PySide6.QtCore import QOperatingSystemVersion
+
class TestQOperatingSystemVersion(unittest.TestCase):
def test(self):
ov = QOperatingSystemVersion.current()
name = f"{ov.name()} v{ov.majorVersion()}.{ov.minorVersion()}.{ov.microVersion()}"
print(name)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qpoint_test.py b/sources/pyside6/tests/QtCore/qpoint_test.py
index 49a4d8c25..a2a92d3ef 100644
--- a/sources/pyside6/tests/QtCore/qpoint_test.py
+++ b/sources/pyside6/tests/QtCore/qpoint_test.py
@@ -43,12 +43,14 @@ from PySide6.QtCore import QPoint, QPointF
class QPointTest(unittest.TestCase):
def testQPointCtor(self):
- point = QPoint(QPoint(10,20))
+ point = QPoint(QPoint(10, 20))
+
class QPointFTest(unittest.TestCase):
def testQPointFCtor(self):
- pointf = QPointF(QPoint(10,20))
+ pointf = QPointF(QPoint(10, 20))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qprocess_test.py b/sources/pyside6/tests/QtCore/qprocess_test.py
index 9e9ca348f..9634f26d3 100644
--- a/sources/pyside6/tests/QtCore/qprocess_test.py
+++ b/sources/pyside6/tests/QtCore/qprocess_test.py
@@ -61,5 +61,6 @@ class TestQProcess (unittest.TestCase):
else:
print("PROCESS ALREADY DEAD :-/")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qproperty_decorator.py b/sources/pyside6/tests/QtCore/qproperty_decorator.py
index 3d9503272..424b9dc9a 100644
--- a/sources/pyside6/tests/QtCore/qproperty_decorator.py
+++ b/sources/pyside6/tests/QtCore/qproperty_decorator.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Property
+
class MyObject(QObject):
def __init__(self):
super().__init__()
@@ -68,5 +69,6 @@ class PropertyTest(unittest.TestCase):
del o
self.assertTrue(self._obDestroyed)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qrandomgenerator_test.py b/sources/pyside6/tests/QtCore/qrandomgenerator_test.py
index fc1c7b872..36d2a0e03 100644
--- a/sources/pyside6/tests/QtCore/qrandomgenerator_test.py
+++ b/sources/pyside6/tests/QtCore/qrandomgenerator_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QRandomGenerator, QRandomGenerator64
+
class QRandomGeneratorTest(unittest.TestCase):
'''Test case for QRandomGenerator'''
@@ -52,5 +53,6 @@ class QRandomGeneratorTest(unittest.TestCase):
generator = QRandomGenerator64()
r = generator.generate()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qrect_test.py b/sources/pyside6/tests/QtCore/qrect_test.py
index 8420f0246..83c3618d5 100644
--- a/sources/pyside6/tests/QtCore/qrect_test.py
+++ b/sources/pyside6/tests/QtCore/qrect_test.py
@@ -41,10 +41,11 @@ init_test_paths(False)
from PySide6.QtCore import QPoint, QRect, QRectF
+
class RectConstructor(unittest.TestCase):
def testDefault(self):
- #QRect()
+ # QRect()
obj = QRect()
self.assertTrue(obj.isNull())
@@ -58,6 +59,7 @@ class RectConstructor(unittest.TestCase):
self.assertEqual(rect1, rect2)
+
class RectOperator(unittest.TestCase):
'''Test case for QRect operators'''
@@ -74,7 +76,7 @@ class RectOperator(unittest.TestCase):
self.assertEqual(rect1, rect2)
def testNullRectIntersection(self):
- #QRect & QRect for null rects
+ # QRect & QRect for null rects
rect1 = QRect()
rect2 = QRect()
rect3 = rect1 & rect2
@@ -90,21 +92,21 @@ class RectOperator(unittest.TestCase):
self.assertEqual(rect3, QRect())
def testIntersectPartial(self):
- #QRect & QRect for partial intersections
+ # QRect & QRect for partial intersections
rect1 = QRect(10, 10, 10, 10)
rect2 = QRect(15, 15, 10, 10)
rect3 = rect1 & rect2
self.assertEqual(rect3, QRect(15, 15, 5, 5))
def testIntersetEnclosed(self):
- #QRect & QRect for a qrect inside another
+ # QRect & QRect for a qrect inside another
rect1 = QRect(10, 10, 20, 20)
rect2 = QRect(15, 15, 5, 5)
rect3 = rect1 & rect2
self.assertEqual(rect3, rect2)
def testNullRectIntersectBounding(self):
- #QRect | QRect for null rects
+ # QRect | QRect for null rects
rect1 = QRect()
rect2 = QRect()
rect3 = rect1 & rect2
@@ -120,14 +122,14 @@ class RectOperator(unittest.TestCase):
self.assertEqual(rect3, QRect(10, 10, 15, 15))
def testBoundingPartialIntersection(self):
- #QRect | QRect for partial intersections
+ # QRect | QRect for partial intersections
rect1 = QRect(10, 10, 10, 10)
rect2 = QRect(15, 15, 10, 10)
rect3 = rect1 | rect2
self.assertEqual(rect3, QRect(10, 10, 15, 15))
def testBoundingEnclosed(self):
- #QRect | QRect for a qrect inside another
+ # QRect | QRect for a qrect inside another
rect1 = QRect(10, 10, 20, 20)
rect2 = QRect(15, 15, 5, 5)
rect3 = rect1 | rect2
@@ -143,6 +145,5 @@ class RectOperator(unittest.TestCase):
self.assertEqual(rect1.getCoords(), (1, 2, 4, 6))
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qregularexpression_test.py b/sources/pyside6/tests/QtCore/qregularexpression_test.py
index 457ff7460..20b582259 100644
--- a/sources/pyside6/tests/QtCore/qregularexpression_test.py
+++ b/sources/pyside6/tests/QtCore/qregularexpression_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QRegularExpression, QRegularExpressionMatch, QRegularExpressionMatchIterator
+
class QRegularExpressionTest(unittest.TestCase):
def testMatch(self):
@@ -55,11 +56,12 @@ class QRegularExpressionTest(unittest.TestCase):
re = QRegularExpression('(\w+)')
self.assertTrue(re.isValid())
count = 0
- it = re.globalMatch('word1 word2 word3');
+ it = re.globalMatch('word1 word2 word3')
while it.hasNext():
it.next()
- count = count + 1
+ count = count + 1
self.assertEqual(count, 3)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qresource_test.py b/sources/pyside6/tests/QtCore/qresource_test.py
index bc6fa0aa1..a9bdbfe51 100644
--- a/sources/pyside6/tests/QtCore/qresource_test.py
+++ b/sources/pyside6/tests/QtCore/qresource_test.py
@@ -42,11 +42,12 @@ init_test_paths(False)
from PySide6.QtCore import QByteArray, QFile, QIODevice
import resources_mc
+
class ResourcesUsage(unittest.TestCase):
'''Test case for resources usage'''
def testPhrase(self):
- #Test loading of quote.txt resource
+ # Test loading of quote.txt resource
file = Path(__file__).resolve().parent / 'quoteEnUS.txt'
self.assertTrue(file.is_file())
orig = QByteArray(file.read_bytes())
@@ -64,7 +65,7 @@ class ResourcesUsage(unittest.TestCase):
self.assertEqual(orig, copy)
def testImage(self):
- #Test loading of sample.png resource
+ # Test loading of sample.png resource
file = Path(__file__).resolve().parent / 'sample.png'
self.assertTrue(file.is_file())
orig = file.read_bytes()
diff --git a/sources/pyside6/tests/QtCore/qsettings_test.py b/sources/pyside6/tests/QtCore/qsettings_test.py
index d46242220..bbb82dc97 100644
--- a/sources/pyside6/tests/QtCore/qsettings_test.py
+++ b/sources/pyside6/tests/QtCore/qsettings_test.py
@@ -39,6 +39,7 @@ init_test_paths(False)
from PySide6.QtCore import QDir, QSettings, QTemporaryDir
+
class TestQSettings(unittest.TestCase):
def testConversions(self):
file = Path(__file__).resolve().parent / 'qsettings_test.ini'
@@ -55,7 +56,6 @@ class TestQSettings(unittest.TestCase):
r = settings.value('var2', type=list)
self.assertEqual(type(r), list)
-
def testDefaultValueConversion(self):
temp_dir = QDir.tempPath()
dir = QTemporaryDir(f'{temp_dir}/qsettings_XXXXXX')
@@ -117,5 +117,6 @@ class TestQSettings(unittest.TestCase):
r = settings.value('lala', 22, type=float)
self.assertEqual(type(r), float)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qsize_test.py b/sources/pyside6/tests/QtCore/qsize_test.py
index 2429352c9..95705f51c 100644
--- a/sources/pyside6/tests/QtCore/qsize_test.py
+++ b/sources/pyside6/tests/QtCore/qsize_test.py
@@ -41,16 +41,17 @@ init_test_paths(False)
from PySide6.QtCore import QSize
+
class QSizeOperator(unittest.TestCase):
def testOperatorMultiply(self):
- #QSize operator * float
+ # QSize operator * float
# bug 131
a = QSize(1, 1)
x = a * 3.4
self.assertEqual(QSize(3, 3), x)
def testOperatorRevertedMultiply(self):
- #QSize operator * float, reverted
+ # QSize operator * float, reverted
# bug 132
a = QSize(1, 1)
x = 3.4 * a
diff --git a/sources/pyside6/tests/QtCore/qslot_object_test.py b/sources/pyside6/tests/QtCore/qslot_object_test.py
index ebde10387..f08791be2 100644
--- a/sources/pyside6/tests/QtCore/qslot_object_test.py
+++ b/sources/pyside6/tests/QtCore/qslot_object_test.py
@@ -44,6 +44,7 @@ This is a simple slot test that was updated to use the qApp "macro".
It is implicitly in builtins and does not need an import.
"""
+
class objTest(QObject):
def __init__(self, parent=None):
diff --git a/sources/pyside6/tests/QtCore/qsrand_test.py b/sources/pyside6/tests/QtCore/qsrand_test.py
index 4db29e24f..4208ab951 100644
--- a/sources/pyside6/tests/QtCore/qsrand_test.py
+++ b/sources/pyside6/tests/QtCore/qsrand_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QRandomGenerator
+
class OverflowExceptionCollect(unittest.TestCase):
'''Test case for OverflowError exception during garbage collection. See bug #147'''
@@ -47,5 +48,6 @@ class OverflowExceptionCollect(unittest.TestCase):
# should not abort if bug #147 is fixed
gc.collect()
+
if __name__ == '__main__':
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qstandardpaths_test.py b/sources/pyside6/tests/QtCore/qstandardpaths_test.py
index 0e5e7358d..070942474 100644
--- a/sources/pyside6/tests/QtCore/qstandardpaths_test.py
+++ b/sources/pyside6/tests/QtCore/qstandardpaths_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QStandardPaths
+
class QStandardPathsTest(unittest.TestCase):
def testTestModeEnabled(self):
print("QStandardPaths.isTestModeEnabled:", QStandardPaths.isTestModeEnabled())
@@ -52,5 +53,6 @@ class QStandardPathsTest(unittest.TestCase):
QStandardPaths.setTestModeEnabled(sp)
self.assertEqual(QStandardPaths.isTestModeEnabled(), sp)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qstorageinfo_test.py b/sources/pyside6/tests/QtCore/qstorageinfo_test.py
index b86b85c1c..35413f081 100644
--- a/sources/pyside6/tests/QtCore/qstorageinfo_test.py
+++ b/sources/pyside6/tests/QtCore/qstorageinfo_test.py
@@ -41,10 +41,12 @@ init_test_paths(False)
from PySide6.QtCore import QStorageInfo
+
class QandardPathsTest(unittest.TestCase):
def testQStorageInfo(self):
for v in QStorageInfo.mountedVolumes():
print(v.name(), v.rootPath(), v.device())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qstring_test.py b/sources/pyside6/tests/QtCore/qstring_test.py
index a07a559a3..a43b2b94a 100644
--- a/sources/pyside6/tests/QtCore/qstring_test.py
+++ b/sources/pyside6/tests/QtCore/qstring_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class QStringConstructor(unittest.TestCase):
'''Test case for QString constructors'''
@@ -54,5 +55,6 @@ class QStringConstructor(unittest.TestCase):
obj.setObjectName(None)
self.assertEqual(obj.objectName(), '')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qsysinfo_test.py b/sources/pyside6/tests/QtCore/qsysinfo_test.py
index 90e241775..ebd0f82ee 100644
--- a/sources/pyside6/tests/QtCore/qsysinfo_test.py
+++ b/sources/pyside6/tests/QtCore/qsysinfo_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QSysInfo
+
class TestQSysInfo(unittest.TestCase):
def testEnumEndian(self):
self.assertEqual(QSysInfo.BigEndian, 0)
@@ -46,5 +47,6 @@ class TestQSysInfo(unittest.TestCase):
def testEnumSizes(self):
self.assertTrue(QSysInfo.WordSize > 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qtextstream_test.py b/sources/pyside6/tests/QtCore/qtextstream_test.py
index b48f716bc..64be2b9a3 100644
--- a/sources/pyside6/tests/QtCore/qtextstream_test.py
+++ b/sources/pyside6/tests/QtCore/qtextstream_test.py
@@ -39,6 +39,7 @@ init_test_paths(False)
from PySide6.QtCore import QByteArray, QTextStream, QIODevice, QFile
+
class QTextStreamShiftTest(unittest.TestCase):
def setUp(self):
@@ -55,6 +56,7 @@ class QTextStreamShiftTest(unittest.TestCase):
self.assertTrue(isinstance(res, str))
self.assertEqual(res, '4')
+
class QTextStreamGetSet(unittest.TestCase):
def setUp(self):
@@ -68,6 +70,7 @@ class QTextStreamGetSet(unittest.TestCase):
self.obj.setDevice(None)
self.assertEqual(None, self.obj.device())
+
class QTextStreamInitialization(unittest.TestCase):
def testConstruction(self):
@@ -80,6 +83,7 @@ class QTextStreamInitialization(unittest.TestCase):
self.assertTrue(obj.atEnd())
self.assertEqual(obj.readAll(), '')
+
class QTextStreamReadLinesFromDevice(unittest.TestCase):
def _check_data(self, data_set):
@@ -108,5 +112,6 @@ class QTextStreamReadLinesFromDevice(unittest.TestCase):
self._check_data(data)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py b/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py
index 339c0a7d6..4b36b7063 100644
--- a/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py
+++ b/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py
@@ -45,36 +45,38 @@ logging.basicConfig(level=logging.WARNING)
from PySide6.QtCore import QThread, QCoreApplication, QObject, SIGNAL
+
class Bucket(QObject):
'''Dummy class to hold the produced values'''
def __init__(self, max_size=10, *args):
- #Constructor which receives the max number of produced items
+ # Constructor which receives the max number of produced items
super().__init__(*args)
self.data = []
self.max_size = 10
def pop(self):
- #Retrieves an item
+ # Retrieves an item
return self.data.pop(0)
def push(self, data):
- #Pushes an item
+ # Pushes an item
self.data.append(data)
+
class Producer(QThread):
'''Producer thread'''
def __init__(self, bucket, *args):
- #Constructor. Receives the bucket
+ # Constructor. Receives the bucket
super().__init__(*args)
self.runs = 0
self.bucket = bucket
self.production_list = []
def run(self):
- #Produces at most bucket.max_size items
+ # Produces at most bucket.max_size items
while self.runs < self.bucket.max_size:
- value = int(random()*10) % 10
+ value = int(random() * 10) % 10
self.bucket.push(value)
self.production_list.append(value)
logging.debug(f'PRODUCER - pushed {value}')
@@ -82,18 +84,17 @@ class Producer(QThread):
self.msleep(5)
-
class Consumer(QThread):
'''Consumer thread'''
def __init__(self, bucket, *args):
- #Constructor. Receives the bucket
+ # Constructor. Receives the bucket
super().__init__(*args)
self.runs = 0
self.bucket = bucket
self.consumption_list = []
def run(self):
- #Consumes at most bucket.max_size items
+ # Consumes at most bucket.max_size items
while self.runs < self.bucket.max_size:
try:
value = self.bucket.pop()
@@ -104,23 +105,24 @@ class Consumer(QThread):
logging.debug('CONSUMER - empty bucket')
self.msleep(5)
+
class ProducerConsumer(unittest.TestCase):
'''Basic test case for producer-consumer QThread'''
def setUp(self):
- #Create fixtures
+ # Create fixtures
self.app = QCoreApplication([])
def tearDown(self):
- #Destroy fixtures
+ # Destroy fixtures
del self.app
def finishCb(self):
- #Quits the application
+ # Quits the application
self.app.exit(0)
def testProdCon(self):
- #QThread producer-consumer example
+ # QThread producer-consumer example
bucket = Bucket()
prod = Producer(bucket)
cons = Consumer(bucket)
diff --git a/sources/pyside6/tests/QtCore/qthread_signal_test.py b/sources/pyside6/tests/QtCore/qthread_signal_test.py
index c50ec0101..d105e93f3 100644
--- a/sources/pyside6/tests/QtCore/qthread_signal_test.py
+++ b/sources/pyside6/tests/QtCore/qthread_signal_test.py
@@ -41,6 +41,7 @@ from PySide6.QtCore import QThread, QObject, SIGNAL, QCoreApplication
thread_run = False
+
class Source(QObject):
def __init__(self, *args):
QObject.__init__(self, *args)
@@ -48,6 +49,7 @@ class Source(QObject):
def emit_sig(self):
self.emit(SIGNAL('source()'))
+
class Target(QObject):
def __init__(self, *args):
QObject.__init__(self, *args)
@@ -56,6 +58,7 @@ class Target(QObject):
def myslot(self):
self.called = True
+
class ThreadJustConnects(QThread):
def __init__(self, source, *args):
QThread.__init__(self, *args)
@@ -71,7 +74,6 @@ class ThreadJustConnects(QThread):
pass
-
class BasicConnection(unittest.TestCase):
def testEmitOutsideThread(self):
@@ -94,5 +96,6 @@ class BasicConnection(unittest.TestCase):
self.assertTrue(thread.target.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qthread_test.py b/sources/pyside6/tests/QtCore/qthread_test.py
index 666d55b7e..25ef5d665 100644
--- a/sources/pyside6/tests/QtCore/qthread_test.py
+++ b/sources/pyside6/tests/QtCore/qthread_test.py
@@ -46,6 +46,7 @@ from helper.usesqcoreapplication import UsesQCoreApplication
mutex = QMutex()
+
class Dummy(QThread):
'''Dummy thread'''
def __init__(self, *args):
@@ -53,12 +54,13 @@ class Dummy(QThread):
self.called = False
def run(self):
- #Start-quit sequence
+ # Start-quit sequence
self.qobj = QObject()
mutex.lock()
self.called = True
mutex.unlock()
+
class QThreadSimpleCase(UsesQCoreApplication):
def setUp(self):
@@ -69,7 +71,7 @@ class QThreadSimpleCase(UsesQCoreApplication):
UsesQCoreApplication.tearDown(self)
def testThread(self):
- #Basic QThread test
+ # Basic QThread test
obj = Dummy()
obj.start()
self.assertTrue(obj.wait(100))
@@ -78,7 +80,7 @@ class QThreadSimpleCase(UsesQCoreApplication):
def cb(self, *args):
self.called = True
- #self.exit_app_cb()
+ # self.exit_app_cb()
def abort_application(self):
if self._thread.isRunning():
@@ -86,7 +88,7 @@ class QThreadSimpleCase(UsesQCoreApplication):
self.app.quit()
def testSignalFinished(self):
- #QThread.finished() (signal)
+ # QThread.finished() (signal)
obj = Dummy()
QObject.connect(obj, SIGNAL('finished()'), self.cb)
mutex.lock()
@@ -100,7 +102,7 @@ class QThreadSimpleCase(UsesQCoreApplication):
self.assertTrue(self.called)
def testSignalStarted(self):
- #QThread.started() (signal)
+ # QThread.started() (signal)
obj = Dummy()
QObject.connect(obj, SIGNAL('started()'), self.cb)
obj.start()
@@ -109,8 +111,9 @@ class QThreadSimpleCase(UsesQCoreApplication):
QTimer.singleShot(1000, self.abort_application)
self.app.exec_()
- self.assertEqual(obj.qobj.thread(), obj) # test QObject.thread() method
+ self.assertEqual(obj.qobj.thread(), obj) # test QObject.thread() method
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py b/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py
index 71f497e54..56d02014b 100644
--- a/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py
+++ b/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QTimer, QCoreApplication, Signal
from helper.usesqcoreapplication import UsesQCoreApplication
+
class WatchDog(QObject):
'''Exits the QCoreApplication main loop after sometime.'''
@@ -55,17 +56,18 @@ class WatchDog(QObject):
if self.times_called == 20:
self.watched.exit_app_cb()
+
class TestSingleShot(UsesQCoreApplication):
'''Test case for QTimer.singleShot'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
UsesQCoreApplication.setUp(self)
self.watchdog = WatchDog(self)
self.called = False
def tearDown(self):
- #Release resources
+ # Release resources
del self.watchdog
del self.called
UsesQCoreApplication.tearDown(self)
@@ -79,6 +81,7 @@ class TestSingleShot(UsesQCoreApplication):
self.app.exec_()
self.assertTrue(self.called)
+
class SigEmitter(QObject):
sig1 = Signal()
@@ -108,6 +111,7 @@ class TestSingleShotSignal(UsesQCoreApplication):
self.app.exec_()
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qtimer_timeout_test.py b/sources/pyside6/tests/QtCore/qtimer_timeout_test.py
index 6f6ff5297..a183d8dd1 100644
--- a/sources/pyside6/tests/QtCore/qtimer_timeout_test.py
+++ b/sources/pyside6/tests/QtCore/qtimer_timeout_test.py
@@ -59,25 +59,25 @@ class TestTimeoutSignal(UsesQCoreApplication):
'''Test case to check if the signals are really being caught'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
UsesQCoreApplication.setUp(self)
self.watchdog = WatchDog(self)
self.timer = QTimer()
self.called = False
def tearDown(self):
- #Release resources
+ # Release resources
del self.watchdog
del self.timer
del self.called
UsesQCoreApplication.tearDown(self)
def callback(self, *args):
- #Default callback
+ # Default callback
self.called = True
def testTimeoutSignal(self):
- #Test the QTimer timeout() signal
+ # Test the QTimer timeout() signal
refCount = sys.getrefcount(self.timer)
QObject.connect(self.timer, SIGNAL('timeout()'), self.callback)
self.timer.start(4)
@@ -88,6 +88,7 @@ class TestTimeoutSignal(UsesQCoreApplication):
self.assertTrue(self.called)
self.assertEqual(sys.getrefcount(self.timer), refCount)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qtimezone_test.py b/sources/pyside6/tests/QtCore/qtimezone_test.py
index d143d0c94..da96f90e7 100644
--- a/sources/pyside6/tests/QtCore/qtimezone_test.py
+++ b/sources/pyside6/tests/QtCore/qtimezone_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QTimeZone
+
class TestQTimeZone (unittest.TestCase):
def testTimeZone(self):
id = bytes('Europe/Berlin', "UTF-8")
@@ -46,5 +47,6 @@ class TestQTimeZone (unittest.TestCase):
name = timeZone.displayName(QTimeZone.GenericTime, QTimeZone.DefaultName)
self.assertTrue(name)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qtnamespace_test.py b/sources/pyside6/tests/QtCore/qtnamespace_test.py
index 7244fd89e..2f76ffcad 100644
--- a/sources/pyside6/tests/QtCore/qtnamespace_test.py
+++ b/sources/pyside6/tests/QtCore/qtnamespace_test.py
@@ -41,11 +41,12 @@ init_test_paths(False)
from PySide6.QtCore import Qt
+
class QtNamespace(unittest.TestCase):
'''Test case for accessing attributes from Qt namespace'''
def testBasic(self):
- #Access to Qt namespace
+ # Access to Qt namespace
getattr(Qt, 'Horizontal')
getattr(Qt, 'WindowMaximizeButtonHint')
self.assertTrue(True)
diff --git a/sources/pyside6/tests/QtCore/qurl_test.py b/sources/pyside6/tests/QtCore/qurl_test.py
index 75f74fbbc..8e5d5caea 100644
--- a/sources/pyside6/tests/QtCore/qurl_test.py
+++ b/sources/pyside6/tests/QtCore/qurl_test.py
@@ -42,16 +42,17 @@ init_test_paths(False)
from PySide6.QtCore import QUrl
from PySide6.QtCore import QUrlQuery
+
class QUrlBasicConstructor(unittest.TestCase):
'''Tests the basic constructors'''
def testBasic(self):
- #Default constructor for QUrl
+ # Default constructor for QUrl
url = QUrl()
self.assertEqual(url.toString(), "")
def testSetAttributes(self):
- #Construct QUrl by set* methods
+ # Construct QUrl by set* methods
url = QUrl()
url.setScheme('ftp')
@@ -75,6 +76,7 @@ class QUrlBasicConstructor(unittest.TestCase):
self.assertEqual(url.toString(),
'ftp://john:abc123@www.google.com:8080/mail/view')
+
class QueryItemsTest(unittest.TestCase):
'''Test query item management'''
@@ -116,13 +118,15 @@ class QueryItemsTest(unittest.TestCase):
for i, data in enumerate(valid_data):
url.addQueryItem(key, data)
self.assertEqual(url.allQueryItemValues(key),
- list(valid_data[:i+1]))
+ list(valid_data[:i + 1]))
def testPath(self):
url = QUrl("http://qt-project.org/images/ban/pgs_front.jpg")
self.assertEqual(url.path(), "/images/ban/pgs_front.jpg")
# PYSIDE-345: No bindings for QUrlQuery
+
+
class QueryItemsTest(unittest.TestCase):
'''Test query item management'''
@@ -164,7 +168,8 @@ class QueryItemsTest(unittest.TestCase):
for i, data in enumerate(valid_data):
url.addQueryItem(key, data)
self.assertEqual(url.allQueryItemValues(key),
- list(valid_data[:i+1]))
+ list(valid_data[:i + 1]))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qurlquery_test.py b/sources/pyside6/tests/QtCore/qurlquery_test.py
index 4e2a8fc14..224f253ff 100644
--- a/sources/pyside6/tests/QtCore/qurlquery_test.py
+++ b/sources/pyside6/tests/QtCore/qurlquery_test.py
@@ -42,22 +42,24 @@ init_test_paths(False)
from PySide6.QtCore import QUrlQuery
+
class QUrlQueryTest(unittest.TestCase):
def testConstructing(self):
empty = QUrlQuery()
self.assertTrue(empty.isEmpty())
- empty.clear();
+ empty.clear()
self.assertTrue(empty.isEmpty())
def testAddRemove(self):
query = QUrlQuery()
- query.addQueryItem("a", "b");
+ query.addQueryItem("a", "b")
self.assertTrue(not query.isEmpty())
self.assertTrue(query.hasQueryItem("a"))
self.assertEqual(query.queryItemValue("a"), "b")
self.assertEqual(query.allQueryItemValues("a"), ["b"])
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/quuid_test.py b/sources/pyside6/tests/QtCore/quuid_test.py
index 215ab68e8..1729eb146 100644
--- a/sources/pyside6/tests/QtCore/quuid_test.py
+++ b/sources/pyside6/tests/QtCore/quuid_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QUuid
+
class QUuidTest(unittest.TestCase):
def testFromString(self):
uuidString = '{fc69b59e-cc34-4436-a43c-ee95d128b8c5}'
@@ -49,5 +50,6 @@ class QUuidTest(unittest.TestCase):
self.assertTrue(not uuid.isNull())
self.assertEqual(uuid.toString(), uuidString)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/qversionnumber_test.py b/sources/pyside6/tests/QtCore/qversionnumber_test.py
index d08a64d25..eb02573a3 100644
--- a/sources/pyside6/tests/QtCore/qversionnumber_test.py
+++ b/sources/pyside6/tests/QtCore/qversionnumber_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QVersionNumber
+
class QVersionNumberTest(unittest.TestCase):
def testFromString(self):
versionString = '5.9.2'
@@ -51,5 +52,6 @@ class QVersionNumberTest(unittest.TestCase):
self.assertEqual(version.microVersion(), 2)
self.assertEqual(version.toString(), versionString)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/repr_test.py b/sources/pyside6/tests/QtCore/repr_test.py
index 72a5e3a9a..8fdb65ef8 100644
--- a/sources/pyside6/tests/QtCore/repr_test.py
+++ b/sources/pyside6/tests/QtCore/repr_test.py
@@ -44,12 +44,14 @@ try:
except ImportError:
HAVE_Q = False
+
class ReprCopyHelper:
def testCopy(self):
copy = eval(self.original.__repr__())
self.assertTrue(copy is not self.original)
self.assertEqual(copy, self.original)
+
class QByteArrayReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QByteArray(bytes('the quick brown fox jumps over the lazy dog', "UTF-8"))
@@ -79,34 +81,42 @@ class QSizeFReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QSizeF(42.7, 190.2)
+
class QRectReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QRect(100, 200, 300, 400)
+
class QRectFReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QRectF(100.33, 200.254, 300.321, 400.123)
+
class QLineReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QLine(1, 2, 3, 4)
+
class QLineFReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QLineF(1.1, 2.2, 3.3, 4.4)
+
class QPointReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QPoint(1, 2)
+
class QPointFReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QPointF(1.1, 2.2)
+
class QUuiCopy(ReprCopyHelper, unittest.TestCase):
@unittest.skipUnless(HAVE_Q, "QUuid is currently not supported on this platform.")
def setUp(self):
self.original = QUuid("67C8770B-44F1-410A-AB9A-F9B5446F13EE")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/resources_mc.py b/sources/pyside6/tests/QtCore/resources_mc.py
index 0de0a8774..acbc561bb 100644
--- a/sources/pyside6/tests/QtCore/resources_mc.py
+++ b/sources/pyside6/tests/QtCore/resources_mc.py
@@ -3562,10 +3562,13 @@ qt_resource_struct = b"""\
\x00\x00\x00\x18\x00\x00\x00\x00\x00\x01\x00\x00\x00\x39\
"""
+
def qInitResources():
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
+
def qCleanupResources():
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
+
qInitResources()
diff --git a/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py b/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py
index a5cded3ac..0cd56ac93 100644
--- a/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py
+++ b/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py
@@ -42,8 +42,9 @@ from PySide6.QtCore import QTimer
class SetPropOnCtorTest(unittest.TestCase):
def testIt(self):
- timer = QTimer(interval = 42)
- self.assertEqual(timer.interval(), 42);
+ timer = QTimer(interval=42)
+ self.assertEqual(timer.interval(), 42)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/snake_prop_feature_test.py b/sources/pyside6/tests/QtCore/snake_prop_feature_test.py
index 9c871dab1..6bfcddec0 100644
--- a/sources/pyside6/tests/QtCore/snake_prop_feature_test.py
+++ b/sources/pyside6/tests/QtCore/snake_prop_feature_test.py
@@ -58,6 +58,7 @@ Test the snake_case and true_property feature.
This works now, including class properties.
"""
+
class Window(QWidget):
def __init__(self):
super().__init__()
diff --git a/sources/pyside6/tests/QtCore/staticMetaObject_test.py b/sources/pyside6/tests/QtCore/staticMetaObject_test.py
index 29ab9a358..77dbcd9fb 100644
--- a/sources/pyside6/tests/QtCore/staticMetaObject_test.py
+++ b/sources/pyside6/tests/QtCore/staticMetaObject_test.py
@@ -37,11 +37,13 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Slot, QMetaObject
+
class MyObject(QObject):
@Slot(int, str)
def slot1(self, a, b):
pass
+
class testAttribute(unittest.TestCase):
def testBug896(self):
mo = MyObject.staticMetaObject
@@ -54,5 +56,6 @@ class testAttribute(unittest.TestCase):
self.assertEqual(mo.indexOfSignal('destroyed(void)'), -1)
self.assertTrue(mo.indexOfSignal('destroyed()') > -1)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/static_method_test.py b/sources/pyside6/tests/QtCore/static_method_test.py
index c395f3770..5119f42a9 100644
--- a/sources/pyside6/tests/QtCore/static_method_test.py
+++ b/sources/pyside6/tests/QtCore/static_method_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QFile
+
class StaticNonStaticMethodsTest(unittest.TestCase):
'''Test cases for overloads involving static and non-static versions of a method.'''
diff --git a/sources/pyside6/tests/QtCore/thread_signals_test.py b/sources/pyside6/tests/QtCore/thread_signals_test.py
index 21e4d7043..0aaa251bb 100644
--- a/sources/pyside6/tests/QtCore/thread_signals_test.py
+++ b/sources/pyside6/tests/QtCore/thread_signals_test.py
@@ -40,14 +40,17 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, QFile, QThread, QTimer, Qt
from helper.usesqcoreapplication import UsesQCoreApplication
+
class MyThread(QThread):
def run(self):
- self.emit(SIGNAL("test(const QString&)"), "INdT - PySide");
+ self.emit(SIGNAL("test(const QString&)"), "INdT - PySide")
+
class TestThreadSignal(UsesQCoreApplication):
__called__ = True
+
def _callback(self, msg):
self.assertEqual(msg, "INdT - PySide")
self.__called__ = True
@@ -55,12 +58,13 @@ class TestThreadSignal(UsesQCoreApplication):
def testThread(self):
t = MyThread()
- QObject.connect(t, SIGNAL("test(const QString&)"), self._callback);
+ QObject.connect(t, SIGNAL("test(const QString&)"), self._callback)
t.start()
self.app.exec_()
t.wait()
- self.assertTrue(self.__called__);
+ self.assertTrue(self.__called__)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/tr_noop_test.py b/sources/pyside6/tests/QtCore/tr_noop_test.py
index 5743c94a3..b2139e754 100644
--- a/sources/pyside6/tests/QtCore/tr_noop_test.py
+++ b/sources/pyside6/tests/QtCore/tr_noop_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QT_TR_NOOP, QT_TR_NOOP_UTF8
from PySide6.QtCore import QT_TRANSLATE_NOOP, QT_TRANSLATE_NOOP3, QT_TRANSLATE_NOOP_UTF8
+
class QtTrNoopTest(unittest.TestCase):
def setUp(self):
diff --git a/sources/pyside6/tests/QtCore/translation_test.py b/sources/pyside6/tests/QtCore/translation_test.py
index 28e618534..fbce644e0 100644
--- a/sources/pyside6/tests/QtCore/translation_test.py
+++ b/sources/pyside6/tests/QtCore/translation_test.py
@@ -44,6 +44,7 @@ from PySide6.QtCore import QObject, QTranslator, QCoreApplication
from helper.usesqcoreapplication import UsesQCoreApplication
+
class TranslationTest(UsesQCoreApplication):
'''Test case for Qt translation facilities.'''
@@ -52,7 +53,7 @@ class TranslationTest(UsesQCoreApplication):
self.trdir = os.path.join(os.path.dirname(__file__), 'translations')
def testLatin(self):
- #Set string value to Latin
+ # Set string value to Latin
translator = QTranslator()
translator.load(os.path.join(self.trdir, 'trans_latin.qm'))
self.app.installTranslator(translator)
@@ -62,7 +63,7 @@ class TranslationTest(UsesQCoreApplication):
self.assertEqual(obj.objectName(), 'Orbis, te saluto!')
def testRussian(self):
- #Set string value to Russian
+ # Set string value to Russian
translator = QTranslator()
translator.load(os.path.join(self.trdir, 'trans_russian.qm'))
self.app.installTranslator(translator)
@@ -86,6 +87,7 @@ class TranslationTest(UsesQCoreApplication):
self.assertTrue(isinstance(obj, str))
self.assertEqual(obj, value)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/unaryoperator_test.py b/sources/pyside6/tests/QtCore/unaryoperator_test.py
index fada917ee..614c92ee5 100644
--- a/sources/pyside6/tests/QtCore/unaryoperator_test.py
+++ b/sources/pyside6/tests/QtCore/unaryoperator_test.py
@@ -41,17 +41,18 @@ init_test_paths(False)
from PySide6.QtCore import QPoint
+
class NegUnaryOperatorTest(unittest.TestCase):
'''Tests the presence of unary operator __neg__ on the QPoint class'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.x, self.y = 10, 20
self.neg_x, self.neg_y = -self.x, -self.y
self.qpoint = QPoint(self.x, self.y)
def tearDown(self):
- #Release resources
+ # Release resources
del self.qpoint
del self.x
del self.y
@@ -59,7 +60,7 @@ class NegUnaryOperatorTest(unittest.TestCase):
del self.neg_y
def testNegUnaryOperator(self):
- #Test __neg__ unary operator on QPoint class
+ # Test __neg__ unary operator on QPoint class
__neg__method_exists = True
try:
neg_qpoint = -self.qpoint
@@ -69,6 +70,7 @@ class NegUnaryOperatorTest(unittest.TestCase):
self.assertTrue(__neg__method_exists)
self.assertEqual(self.qpoint, -neg_qpoint)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/unicode_test.py b/sources/pyside6/tests/QtCore/unicode_test.py
index 1d3a729fa..18910be29 100644
--- a/sources/pyside6/tests/QtCore/unicode_test.py
+++ b/sources/pyside6/tests/QtCore/unicode_test.py
@@ -43,6 +43,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
from PySide6.QtCore import QByteArray
+
class UnicodeConversion(unittest.TestCase):
'''Test case for QString to/from Python Unicode conversion'''
@@ -53,17 +54,18 @@ class UnicodeConversion(unittest.TestCase):
pass
def testSetRegularStringRetrieveUnicode(self):
- #Set regular Python string retrieve unicode
+ # Set regular Python string retrieve unicode
obj = QObject()
obj.setObjectName('test')
self.assertEqual(obj.objectName(), 'test')
def testSetUnicodeRetrieveUnicode(self):
- #Set Python unicode string and retrieve unicode
+ # Set Python unicode string and retrieve unicode
obj = QObject()
obj.setObjectName('ümlaut')
self.assertEqual(obj.objectName(), 'ümlaut')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtCore/versioninfo_test.py b/sources/pyside6/tests/QtCore/versioninfo_test.py
index 9a31dfc00..85d774dde 100644
--- a/sources/pyside6/tests/QtCore/versioninfo_test.py
+++ b/sources/pyside6/tests/QtCore/versioninfo_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
import PySide6
+
class TestVersionInfo(unittest.TestCase):
def testIt(self):
diff --git a/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py b/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py
index ded306ebc..7e4c343ff 100644
--- a/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py
+++ b/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py
@@ -52,12 +52,14 @@ def dataToBarDataRow(data):
result.append(QBarDataItem(d))
return result
+
def dataToBarDataArray(data):
result = []
for row in data:
result.append(dataToBarDataRow(row))
return result
+
class QtDataVisualizationTestCase(UsesQGuiApplication):
'''Tests related to QtDataVisualization'''
@@ -76,7 +78,7 @@ class QtDataVisualizationTestCase(UsesQGuiApplication):
self.valueAxis = QValue3DAxis()
self.valueAxis.setTitle('Values')
self.valueAxis.setTitleVisible(True)
- self.valueAxis.setRange(0, 5);
+ self.valueAxis.setRange(0, 5)
self.bars.setRowAxis(self.rowAxis)
self.bars.setColumnAxis(self.columnAxis)
diff --git a/sources/pyside6/tests/QtGui/bug_1091.py b/sources/pyside6/tests/QtGui/bug_1091.py
index 1e5ae4ce6..965f14811 100644
--- a/sources/pyside6/tests/QtGui/bug_1091.py
+++ b/sources/pyside6/tests/QtGui/bug_1091.py
@@ -45,5 +45,6 @@ class QPainterTestCase(unittest.TestCase):
self.assertTrue("PixmapFragment" in dir(QPainter))
self.assertTrue("drawPixmapFragments" in dir(QPainter))
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_300_test.py b/sources/pyside6/tests/QtGui/bug_300_test.py
index 8d944840c..9a708f903 100644
--- a/sources/pyside6/tests/QtGui/bug_300_test.py
+++ b/sources/pyside6/tests/QtGui/bug_300_test.py
@@ -45,9 +45,10 @@ class TestQAbstractItemModelSignals(unittest.TestCase):
def testSignals(self):
self._called = False
m = QStringListModel()
- m.rowsAboutToBeInserted[QModelIndex,int,int].connect(self.sigCallback)
+ m.rowsAboutToBeInserted[QModelIndex, int, int].connect(self.sigCallback)
m.insertRows(0, 3)
self.assertTrue(self._called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_367.py b/sources/pyside6/tests/QtGui/bug_367.py
index 2dfc140f4..eba44105c 100644
--- a/sources/pyside6/tests/QtGui/bug_367.py
+++ b/sources/pyside6/tests/QtGui/bug_367.py
@@ -47,12 +47,13 @@ class BugTest(UsesQApplication):
parentItem = model.invisibleRootItem()
for i in range(10):
item = QStandardItem()
- rcount = sys.getrefcount(item)
+ rcount = sys.getrefcount(item)
parentItem.appendRow(item)
- self.assertEqual(rcount+1, sys.getrefcount(item))
+ self.assertEqual(rcount + 1, sys.getrefcount(item))
parentItem = item
self.assertTrue(True)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_480.py b/sources/pyside6/tests/QtGui/bug_480.py
index 39707fb01..cd3fd1d6b 100644
--- a/sources/pyside6/tests/QtGui/bug_480.py
+++ b/sources/pyside6/tests/QtGui/bug_480.py
@@ -49,6 +49,7 @@ class BuggyWidget(QWidget):
# this cause a segfault during the ownership transfer
self.verticalLayout.addLayout(self.gridLayout)
+
class LayoutTransferOwnerShip(unittest.TestCase):
def testBug(self):
app = QApplication([])
@@ -57,6 +58,7 @@ class LayoutTransferOwnerShip(unittest.TestCase):
w.show()
self.assertTrue(True)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_606.py b/sources/pyside6/tests/QtGui/bug_606.py
index 918960612..e82cdc593 100644
--- a/sources/pyside6/tests/QtGui/bug_606.py
+++ b/sources/pyside6/tests/QtGui/bug_606.py
@@ -39,6 +39,7 @@ import PySide6
from PySide6.QtGui import QVector2D, QVector3D, QVector4D
from PySide6.QtGui import QColor
+
class testCases(unittest.TestCase):
def testQVector2DToTuple(self):
vec = QVector2D(1, 2)
@@ -57,5 +58,6 @@ class testCases(unittest.TestCase):
c.setRgb(1, 2, 3)
self.assertEqual((1, 2, 3, 255), c.toTuple())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_617.py b/sources/pyside6/tests/QtGui/bug_617.py
index 008ab488f..d917745be 100644
--- a/sources/pyside6/tests/QtGui/bug_617.py
+++ b/sources/pyside6/tests/QtGui/bug_617.py
@@ -54,5 +54,6 @@ class Bug617(unittest.TestCase):
e = MyEvent()
self.assertEqual(repr(e.type()), 'PySide6.QtCore.QEvent.Type(999)')
+
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_652.py b/sources/pyside6/tests/QtGui/bug_652.py
index 3758f2edc..5feecd64a 100644
--- a/sources/pyside6/tests/QtGui/bug_652.py
+++ b/sources/pyside6/tests/QtGui/bug_652.py
@@ -46,6 +46,7 @@ class MyData(QTextBlockUserData):
def getMyNiceData(self):
return self.data
+
class TestBug652(unittest.TestCase):
"""Segfault when using QTextBlock::setUserData due to missing ownership transfer"""
def testIt(self):
@@ -63,5 +64,6 @@ class TestBug652(unittest.TestCase):
self.assertEqual(type(blk.userData()), MyData)
self.assertEqual(blk.userData().getMyNiceData(), heyHo)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_660.py b/sources/pyside6/tests/QtGui/bug_660.py
index 61ae00a11..9c3cdcfe6 100644
--- a/sources/pyside6/tests/QtGui/bug_660.py
+++ b/sources/pyside6/tests/QtGui/bug_660.py
@@ -37,26 +37,29 @@ init_test_paths(False)
from PySide6.QtGui import QStandardItemModel, QStandardItem
+
class MyItemModel(QStandardItemModel):
- def __init__(self,parent=None):
+ def __init__(self, parent=None):
super().__init__(parent)
self.appendRow([QStandardItem('Item 1'),])
def mimeTypes(self):
- mtypes = super(MyItemModel,self).mimeTypes()
+ mtypes = super(MyItemModel, self).mimeTypes()
mtypes.append('application/my-form')
return mtypes
- def mimeData(self,indexes):
- self.__mimedata = super(MyItemModel,self).mimeData(indexes)
- self.__mimedata.setData('application/my-form',bytes('hi', "UTF-8"))
+ def mimeData(self, indexes):
+ self.__mimedata = super(MyItemModel, self).mimeData(indexes)
+ self.__mimedata.setData('application/my-form', bytes('hi', "UTF-8"))
return self.__mimedata
+
class TestBug660(unittest.TestCase):
'''QMimeData type deleted prematurely when overriding mime-type in QStandardItemModel drag and drop'''
def testIt(self):
model = MyItemModel()
- model.mimeData([model.index(0, 0)]) # if it doesn't raise an exception it's all right!
+ model.mimeData([model.index(0, 0)]) # if it doesn't raise an exception it's all right!
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_740.py b/sources/pyside6/tests/QtGui/bug_740.py
index 91aa23c86..41824fb70 100644
--- a/sources/pyside6/tests/QtGui/bug_740.py
+++ b/sources/pyside6/tests/QtGui/bug_740.py
@@ -39,10 +39,12 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtCore import QSize
from PySide6.QtGui import QBitmap, QImage
+
class TestQBitmap(UsesQApplication):
def testFromDataMethod(self):
dataBits = bytes('\x38\x28\x38\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\xfe\xfe\x7c\x7c\x38\x38\x10\x10', "UTF-8")
- bim = QBitmap.fromData(QSize(8, 48), dataBits, QImage.Format_Mono) # missing function
+ bim = QBitmap.fromData(QSize(8, 48), dataBits, QImage.Format_Mono) # missing function
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_743.py b/sources/pyside6/tests/QtGui/bug_743.py
index e74b32ba3..189eaf2c8 100644
--- a/sources/pyside6/tests/QtGui/bug_743.py
+++ b/sources/pyside6/tests/QtGui/bug_743.py
@@ -37,14 +37,16 @@ init_test_paths(False)
from PySide6.QtGui import QMatrix4x4
+
class TestQMatrix(unittest.TestCase):
def testOperator(self):
- m = QMatrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ m = QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
v = 1
for x in range(4):
for y in range(4):
- self.assertEqual(m[x,y], v)
+ self.assertEqual(m[x, y], v)
v += 1
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_991.py b/sources/pyside6/tests/QtGui/bug_991.py
index 4738f4f04..3bdf0b02f 100644
--- a/sources/pyside6/tests/QtGui/bug_991.py
+++ b/sources/pyside6/tests/QtGui/bug_991.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
from PySide6.QtGui import QPen, QBrush
+
class TestBug991 (unittest.TestCase):
def testReprFunction(self):
reprPen = repr(QPen())
@@ -47,5 +48,6 @@ class TestBug991 (unittest.TestCase):
reprObject = repr(QObject())
self.assertTrue(reprObject.startswith("<PySide6.QtCore.QObject"))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py b/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py
index f221aebd4..3dfada26c 100644
--- a/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py
+++ b/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py
@@ -51,6 +51,7 @@ def testList():
QVector2D(1, 1), QVector3D(1, 1, 1), QVector4D(1, 1, 1, 1),
QQuaternion(1, 1, 1, 1)]
+
class TestMulDiv(unittest.TestCase):
def testMultiplication(self):
@@ -69,5 +70,6 @@ class TestMulDiv(unittest.TestCase):
fails += ' ' + type(a).__name__
self.assertEqual(fails, '')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/deepcopy_test.py b/sources/pyside6/tests/QtGui/deepcopy_test.py
index e1f0240b0..ca7692c39 100644
--- a/sources/pyside6/tests/QtGui/deepcopy_test.py
+++ b/sources/pyside6/tests/QtGui/deepcopy_test.py
@@ -44,12 +44,14 @@ from PySide6.QtGui import QVector2D, QVector3D, QVector4D
from PySide6.QtGui import QColor, QTransform, QKeySequence, QQuaternion
from PySide6.QtGui import QPolygon
+
class DeepCopyHelper:
def testCopy(self):
copy = deepcopy([self.original])[0]
self.assertTrue(copy is not self.original)
self.assertEqual(copy, self.original)
+
class DeepCopyColorHelperF:
def testCopy(self):
copy = deepcopy([self.original])[0]
@@ -63,46 +65,57 @@ class QColorDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QColor("red")
+
class QColorRGBDeepCopy(DeepCopyColorHelperF, unittest.TestCase):
def setUp(self):
self.original = QColor.fromRgbF(0.2, 0.3, 0.4, 0.5)
+
class QColorHSLDeepCopy(DeepCopyColorHelperF, unittest.TestCase):
def setUp(self):
self.original = QColor.fromHslF(0.2, 0.3, 0.4, 0.5)
+
class QColorHSVDeepCopy(DeepCopyColorHelperF, unittest.TestCase):
def setUp(self):
self.original = QColor.fromHsvF(0.2, 0.3, 0.4, 0.5)
+
class QColorCMYKDeepCopy(DeepCopyColorHelperF, unittest.TestCase):
def setUp(self):
self.original = QColor.fromCmykF(0.2, 0.3, 0.4, 0.5, 0.6)
+
class QTransformDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8, 9)
+
class QKeySequenceDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QKeySequence("Ctrl+P")
+
class QQuaternionDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QQuaternion(1, 2, 3, 4)
+
class QVector2DDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector2D(1, 2)
+
class QVector3DDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector3D(1, 2, 3)
+
class QVector4DDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector4D(1, 2, 3, 4)
+
class QPolygonDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QPolygon([QPoint(1, 2), QPoint(3, 4), QPoint(5, 6)])
diff --git a/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
index 2537bc5b2..5383f79d7 100644
--- a/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
+++ b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
@@ -41,23 +41,24 @@ from PySide6.QtGui import QImage, qRgb
from helper.usesqapplication import UsesQApplication
+
class SetPixelFloat(UsesQApplication):
'''Test case for calling setPixel with float as argument'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(SetPixelFloat, self).setUp()
self.color = qRgb(255, 0, 0)
self.image = QImage(200, 200, QImage.Format_RGB32)
def tearDown(self):
- #Release resources
+ # Release resources
del self.color
del self.image
super(SetPixelFloat, self).tearDown()
def testFloat(self):
- #QImage.setPixel(float, float, color) - Implicit conversion
+ # QImage.setPixel(float, float, color) - Implicit conversion
self.image.setPixel(3.14, 4.2, self.color)
self.assertEqual(self.image.pixel(3.14, 4.2), self.color)
diff --git a/sources/pyside6/tests/QtGui/pyside_reload_test.py b/sources/pyside6/tests/QtGui/pyside_reload_test.py
index 87d311596..1c3070e57 100644
--- a/sources/pyside6/tests/QtGui/pyside_reload_test.py
+++ b/sources/pyside6/tests/QtGui/pyside_reload_test.py
@@ -46,6 +46,7 @@ dst = os.path.join(workdir, 'test_module.py')
shutil.copyfile(src, dst)
sys.path.append(workdir)
+
def reload_module(moduleName):
importlib.reload(moduleName)
@@ -60,6 +61,7 @@ def increment_module_value():
cacheFile = importlib.util.cache_from_source(dst)
os.remove(cacheFile)
+
class TestModuleReloading(unittest.TestCase):
def testModuleReloading(self):
@@ -79,6 +81,7 @@ class TestModuleReloading(unittest.TestCase):
reload_module(sys.modules['test_module'])
self.assertEqual(test_module.Sentinel.value, 12)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qcolor_reduce_test.py b/sources/pyside6/tests/QtGui/qcolor_reduce_test.py
index ce855dba1..0df95781c 100644
--- a/sources/pyside6/tests/QtGui/qcolor_reduce_test.py
+++ b/sources/pyside6/tests/QtGui/qcolor_reduce_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtGui import QColor
+
class TestQColor (unittest.TestCase):
def reduceColor(self, c):
p = pickle.dumps(c)
@@ -63,5 +64,6 @@ class TestQColor (unittest.TestCase):
def testReduceHsv(self):
self.reduceColor(QColor.fromHsvF(0.1, 0.2, 0.3, 0.4))
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qcolor_test.py b/sources/pyside6/tests/QtGui/qcolor_test.py
index 6eaaa94a9..85ba2de2d 100644
--- a/sources/pyside6/tests/QtGui/qcolor_test.py
+++ b/sources/pyside6/tests/QtGui/qcolor_test.py
@@ -50,21 +50,21 @@ class QColorGetTest(unittest.TestCase):
self.assertEqual(self.color.getRgb(), (20, 40, 60, 80))
def testGetHslF(self):
- hls = colorsys.rgb_to_hls(20.0/255, 40.0/255, 60.0/255)
+ hls = colorsys.rgb_to_hls(20.0 / 255, 40.0 / 255, 60.0 / 255)
hsla = hls[0], hls[2], hls[1], self.color.alphaF()
- for x, y in zip(self.color.getHslF(), hsla): # Due to rounding problems
- self.assertTrue(x - y < 1/100000.0)
+ for x, y in zip(self.color.getHslF(), hsla): # Due to rounding problems
+ self.assertTrue(x - y < 1 / 100000.0)
def testGetHsv(self):
- hsv = colorsys.rgb_to_hsv(20.0/255, 40.0/255, 60.0/255)
- hsva = int(hsv[0]*360.0), int(hsv[1]*255), int(hsv[2]*256), self.color.alpha()
+ hsv = colorsys.rgb_to_hsv(20.0 / 255, 40.0 / 255, 60.0 / 255)
+ hsva = int(hsv[0] * 360.0), int(hsv[1] * 255), int(hsv[2] * 256), self.color.alpha()
self.assertEqual(self.color.getHsv(), hsva)
- def testGetCmyk(self): # not supported by colorsys
+ def testGetCmyk(self): # not supported by colorsys
self.assertEqual(self.color.getCmyk(), (170, 85, 0, 195, 80))
- def testGetCmykF(self): # not supported by colorsys
- for x, y in zip(self.color.getCmykF(), (170/255.0, 85/255.0, 0, 195/255.0, 80/255.0)):
+ def testGetCmykF(self): # not supported by colorsys
+ for x, y in zip(self.color.getCmykF(), (170 / 255.0, 85 / 255.0, 0, 195 / 255.0, 80 / 255.0)):
self.assertTrue(x - y < 1/10000.0)
@@ -76,7 +76,7 @@ class QColorQRgbConstructor(unittest.TestCase):
def testBasic(self):
'''QColor(QRgb)'''
color = QColor(255, 0, 0)
- #QRgb format #AARRGGBB
+ # QRgb format #AARRGGBB
rgb = 0x00FF0000
self.assertEqual(QColor(rgb), color)
@@ -126,5 +126,6 @@ class QColorRepr(unittest.TestCase):
c2 = eval(c.__str__())
self.assertEqual(c, c2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qcursor_test.py b/sources/pyside6/tests/QtGui/qcursor_test.py
index fcab714a9..181ad29cd 100644
--- a/sources/pyside6/tests/QtGui/qcursor_test.py
+++ b/sources/pyside6/tests/QtGui/qcursor_test.py
@@ -42,11 +42,13 @@ init_test_paths(False)
from PySide6.QtGui import QBitmap, QCursor, QPixmap
from helper.usesqapplication import UsesQApplication
+
class TestQCursor(UsesQApplication):
def testQCursorConstructor(self):
bmp = QBitmap(16, 16)
cursor = QCursor(bmp, bmp, 16, 16)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py b/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py
index ed1ff4528..83d206cce 100644
--- a/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py
+++ b/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py
@@ -42,6 +42,7 @@ from PySide6.QtGui import QPixmap, QColor
from helper.usesqapplication import UsesQApplication
+
class QPixmapQDatastream(UsesQApplication):
'''QDataStream <<>> QPixmap'''
@@ -62,7 +63,7 @@ class QPixmapQDatastream(UsesQApplication):
self.read_stream >> self.output_pixmap
image = self.output_pixmap.toImage()
- pixel = image.pixel(10,10)
+ pixel = image.pixel(10, 10)
self.assertEqual(pixel, QColor(Qt.transparent).rgba())
self.assertEqual(self.source_pixmap.toImage(), image)
diff --git a/sources/pyside6/tests/QtGui/qdesktopservices_test.py b/sources/pyside6/tests/QtGui/qdesktopservices_test.py
index fb635e142..1981b52a6 100644
--- a/sources/pyside6/tests/QtGui/qdesktopservices_test.py
+++ b/sources/pyside6/tests/QtGui/qdesktopservices_test.py
@@ -40,11 +40,13 @@ init_test_paths(False)
from PySide6.QtGui import QDesktopServices
from PySide6.QtCore import QUrl
+
class QDesktopServicesTest(unittest.TestCase):
def testOpenUrl(self):
# At the bare minimum check that they return false for invalid url's
url = QUrl()
self.assertEqual(QDesktopServices.openUrl(url), False)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qfontmetrics_test.py b/sources/pyside6/tests/QtGui/qfontmetrics_test.py
index 44ae75a0d..9f3099acd 100644
--- a/sources/pyside6/tests/QtGui/qfontmetrics_test.py
+++ b/sources/pyside6/tests/QtGui/qfontmetrics_test.py
@@ -230,5 +230,6 @@ class QCharTest(QFontMetricsFTest):
retCh = self.metrics.horizontalAdvance('a')
self.assertTrue(retCh > 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qguiapplication_test.py b/sources/pyside6/tests/QtGui/qguiapplication_test.py
index 35b9574ea..ae661b695 100644
--- a/sources/pyside6/tests/QtGui/qguiapplication_test.py
+++ b/sources/pyside6/tests/QtGui/qguiapplication_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtGui import QGuiApplication
+
class TestQGuiApplication(unittest.TestCase):
def testNoArguments(self):
app = QGuiApplication()
diff --git a/sources/pyside6/tests/QtGui/qicon_test.py b/sources/pyside6/tests/QtGui/qicon_test.py
index 24378b844..a7a1d6bf7 100644
--- a/sources/pyside6/tests/QtGui/qicon_test.py
+++ b/sources/pyside6/tests/QtGui/qicon_test.py
@@ -47,5 +47,6 @@ class QIconCtorWithNoneTest(TimedQApplication):
pixmap = icon.pixmap(48, 48)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qitemselection_test.py b/sources/pyside6/tests/QtGui/qitemselection_test.py
index 157c1bacb..1cfa92774 100644
--- a/sources/pyside6/tests/QtGui/qitemselection_test.py
+++ b/sources/pyside6/tests/QtGui/qitemselection_test.py
@@ -39,6 +39,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtCore import QItemSelection
from PySide6.QtGui import QStandardItemModel
+
class QItemSelectionTest(UsesQApplication):
def testLen(self):
model = QStandardItemModel(2, 2)
@@ -46,9 +47,10 @@ class QItemSelectionTest(UsesQApplication):
model.insertRow(1)
model.insertColumn(0)
model.insertColumn(1)
- selection = QItemSelection(model.index(0,0), model.index(1,1))
+ selection = QItemSelection(model.index(0, 0), model.index(1, 1))
self.assertEqual(len(selection), 1)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qkeysequence_test.py b/sources/pyside6/tests/QtGui/qkeysequence_test.py
index 896447740..3bcdf636b 100644
--- a/sources/pyside6/tests/QtGui/qkeysequence_test.py
+++ b/sources/pyside6/tests/QtGui/qkeysequence_test.py
@@ -40,6 +40,7 @@ from PySide6.QtGui import QKeySequence
from helper.usesqapplication import UsesQApplication
+
class QKeySequenceTest(UsesQApplication):
def testGetItemOperator(self):
diff --git a/sources/pyside6/tests/QtGui/qpainter_test.py b/sources/pyside6/tests/QtGui/qpainter_test.py
index 752475494..2a9db8598 100644
--- a/sources/pyside6/tests/QtGui/qpainter_test.py
+++ b/sources/pyside6/tests/QtGui/qpainter_test.py
@@ -86,12 +86,12 @@ class QPainterDrawText(UsesQGuiApplication):
def testDrawOverloads(self):
'''Calls QPainter.drawLines overloads, if something is
wrong Exception and chaos ensues. Bug #395'''
- self.painter.drawLines([QLine(QPoint(0,0), QPoint(1,1))])
- self.painter.drawLines([QPoint(0,0), QPoint(1,1)])
- self.painter.drawLines([QPointF(0,0), QPointF(1,1)])
- self.painter.drawLines([QLineF(QPointF(0,0), QPointF(1,1))])
- self.painter.drawPoints([QPoint(0,0), QPoint(1,1)])
- self.painter.drawPoints([QPointF(0,0), QPointF(1,1)])
+ self.painter.drawLines([QLine(QPoint(0, 0), QPoint(1, 1))])
+ self.painter.drawLines([QPoint(0, 0), QPoint(1, 1)])
+ self.painter.drawLines([QPointF(0, 0), QPointF(1, 1)])
+ self.painter.drawLines([QLineF(QPointF(0, 0), QPointF(1, 1))])
+ self.painter.drawPoints([QPoint(0, 0), QPoint(1, 1)])
+ self.painter.drawPoints([QPointF(0, 0), QPointF(1, 1)])
self.painter.drawConvexPolygon([QPointF(10.0, 80.0),
QPointF(20.0, 10.0),
QPointF(80.0, 30.0),
@@ -122,7 +122,6 @@ class QPainterDrawText(UsesQGuiApplication):
self.painter.drawPointsNp(x, y)
-
class SetBrushWithOtherArgs(UsesQGuiApplication):
'''Using qpainter.setBrush with args other than QBrush'''
diff --git a/sources/pyside6/tests/QtGui/qpdfwriter_test.py b/sources/pyside6/tests/QtGui/qpdfwriter_test.py
index a58b9242e..61a16159f 100644
--- a/sources/pyside6/tests/QtGui/qpdfwriter_test.py
+++ b/sources/pyside6/tests/QtGui/qpdfwriter_test.py
@@ -39,6 +39,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtGui import QPageLayout, QPageSize, QPdfWriter, QTextDocument
from PySide6.QtCore import QDir, QMarginsF, QTemporaryFile
+
class QPdfWriterTest(UsesQApplication):
def testWrite(self):
@@ -51,5 +52,6 @@ class QPdfWriterTest(UsesQApplication):
temporaryFile.close()
self.assertTrue(temporaryFile.size() > 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qpixelformat_test.py b/sources/pyside6/tests/QtGui/qpixelformat_test.py
index 30241f50d..448bc3d5a 100644
--- a/sources/pyside6/tests/QtGui/qpixelformat_test.py
+++ b/sources/pyside6/tests/QtGui/qpixelformat_test.py
@@ -41,6 +41,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtCore import QSize, Qt
from PySide6.QtGui import QColor, QImage, QPixelFormat
+
class QPixelFormatTest(UsesQApplication):
def test(self):
image = QImage(QSize(200, 200), QImage.Format_ARGB32)
@@ -53,5 +54,6 @@ class QPixelFormatTest(UsesQApplication):
self.assertEqual(pixelFormat.blueSize(), 8)
self.assertEqual(pixelFormat.bitsPerPixel(), 32)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qpixmap_test.py b/sources/pyside6/tests/QtGui/qpixmap_test.py
index 9da7044f9..70de1ebf6 100644
--- a/sources/pyside6/tests/QtGui/qpixmap_test.py
+++ b/sources/pyside6/tests/QtGui/qpixmap_test.py
@@ -48,7 +48,7 @@ class QPixmapTest(UsesQApplication):
self.assertEqual(type(obj.property('foo')), QPixmap)
def testQSizeConstructor(self):
- pixmap = QPixmap(QSize(10,20))
+ pixmap = QPixmap(QSize(10, 20))
self.assertTrue(pixmap.size().height(), 20)
def testQStringConstructor(self):
@@ -63,7 +63,7 @@ class QPixmapTest(UsesQApplication):
self.assertTrue(pixmap.loadFromData(data))
def testQPixmapLoadFromDataWithPython(self):
- data = open(os.path.join(os.path.dirname(__file__),'sample.png'),'rb').read()
+ data = open(os.path.join(os.path.dirname(__file__), 'sample.png'), 'rb').read()
pixmap = QPixmap()
self.assertTrue(pixmap.loadFromData(data))
@@ -73,7 +73,7 @@ class QPixmapToImage(UsesQApplication):
def testFilledImage(self):
'''QPixmap.fill + toImage + image.pixel'''
pixmap = QPixmap(100, 200)
- pixmap.fill(Qt.red) # Default Qt.white
+ pixmap.fill(Qt.red) # Default Qt.white
self.assertEqual(pixmap.height(), 200)
self.assertEqual(pixmap.width(), 100)
@@ -83,7 +83,7 @@ class QPixmapToImage(UsesQApplication):
self.assertEqual(image.height(), 200)
self.assertEqual(image.width(), 100)
- pixel = image.pixel(10,10)
+ pixel = image.pixel(10, 10)
self.assertEqual(pixel, QColor(Qt.red).rgba())
diff --git a/sources/pyside6/tests/QtGui/qpixmapcache_test.py b/sources/pyside6/tests/QtGui/qpixmapcache_test.py
index 3b45b1b91..6a7ef330a 100644
--- a/sources/pyside6/tests/QtGui/qpixmapcache_test.py
+++ b/sources/pyside6/tests/QtGui/qpixmapcache_test.py
@@ -75,6 +75,7 @@ class QPixmapCacheTest(UsesQApplication):
self.assertEqual(QPixmapCache.find(key).toImage().bits(), pm3.toImage().bits())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qradialgradient_test.py b/sources/pyside6/tests/QtGui/qradialgradient_test.py
index 61a9fc3ef..e36fc6fd9 100644
--- a/sources/pyside6/tests/QtGui/qradialgradient_test.py
+++ b/sources/pyside6/tests/QtGui/qradialgradient_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtGui import QRadialGradient
from PySide6.QtCore import QPointF
+
class QRadialGradientConstructor(unittest.TestCase):
def _compare(self, qptf, tpl):
self.assertEqual((qptf.x(), qptf.y()), tpl)
@@ -60,5 +61,6 @@ class QRadialGradientConstructor(unittest.TestCase):
grad.setCenter(QPointF(1, 2))
self._compare(grad.center(), (1.0, 2.0))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qregion_test.py b/sources/pyside6/tests/QtGui/qregion_test.py
index bd843e162..e5b6a1d56 100644
--- a/sources/pyside6/tests/QtGui/qregion_test.py
+++ b/sources/pyside6/tests/QtGui/qregion_test.py
@@ -39,6 +39,7 @@ from PySide6.QtGui import QRegion
from PySide6.QtCore import QPoint
from helper.usesqapplication import UsesQApplication
+
class QRegionTest(UsesQApplication):
def testFunctionUnit(self):
@@ -46,10 +47,11 @@ class QRegionTest(UsesQApplication):
r2 = QRegion(5, 5, 10, 10)
ru = r.united(r2)
- self.assertTrue(ru.contains(QPoint(0,0)))
- self.assertTrue(ru.contains(QPoint(5,5)))
- self.assertTrue(ru.contains(QPoint(10,10)))
- self.assertTrue(ru.contains(QPoint(14,14)))
+ self.assertTrue(ru.contains(QPoint(0, 0)))
+ self.assertTrue(ru.contains(QPoint(5, 5)))
+ self.assertTrue(ru.contains(QPoint(10, 10)))
+ self.assertTrue(ru.contains(QPoint(14, 14)))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qstylehints_test.py b/sources/pyside6/tests/QtGui/qstylehints_test.py
index b7b2e9471..c113469ee 100644
--- a/sources/pyside6/tests/QtGui/qstylehints_test.py
+++ b/sources/pyside6/tests/QtGui/qstylehints_test.py
@@ -40,10 +40,12 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
from PySide6.QtGui import QStyleHints
+
class QStyleHintsTest(UsesQApplication):
def test(self):
styleHints = self.app.styleHints()
self.assertTrue(styleHints.startDragDistance() > 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py b/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py
index caeb0e7cc..8ef520eea 100644
--- a/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py
+++ b/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtGui import QTextDocument, QTextCursor
+
class QTextDocumentTest(unittest.TestCase):
def testUndoRedo(self):
@@ -60,6 +61,7 @@ class QTextDocumentTest(unittest.TestCase):
self.assertTrue(doc.isUndoAvailable())
self.assertEqual(doc.toPlainText(), text)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py b/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py
index cf3721684..6838931d4 100644
--- a/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py
+++ b/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py
@@ -46,10 +46,11 @@ class QTextDocumentWriterTest(unittest.TestCase):
doc = QTextDocument(text)
b = QBuffer()
b.open(QBuffer.ReadWrite)
- writer = QTextDocumentWriter(b, bytes("plaintext", "UTF-8"));
- writer.write(doc);
+ writer = QTextDocumentWriter(b, bytes("plaintext", "UTF-8"))
+ writer.write(doc)
b.close()
self.assertEqual(b.buffer(), text)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qtextline_test.py b/sources/pyside6/tests/QtGui/qtextline_test.py
index 58bd48620..511292d9b 100644
--- a/sources/pyside6/tests/QtGui/qtextline_test.py
+++ b/sources/pyside6/tests/QtGui/qtextline_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtGui import QTextLayout
from helper.usesqapplication import UsesQApplication
+
class QTextLineTest(UsesQApplication):
def testCursorToX(self):
@@ -52,6 +53,7 @@ class QTextLineTest(UsesQApplication):
self.assertEqual(type(x), float)
self.assertEqual(type(cursorPos), int)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtGui/qtransform_test.py b/sources/pyside6/tests/QtGui/qtransform_test.py
index 8fcddf3ec..777e88225 100644
--- a/sources/pyside6/tests/QtGui/qtransform_test.py
+++ b/sources/pyside6/tests/QtGui/qtransform_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtCore import QPointF
from PySide6.QtGui import QTransform, QPolygonF, QPolygonF
+
class QTransformTest(unittest.TestCase):
def testMap(self):
@@ -86,7 +87,6 @@ class QTransformTest(unittest.TestCase):
self.assertEqual(t1, r2)
-
def testsquareToQuad(self):
q1 = QPolygonF()
q1.append(QPointF(10.0, 10.0))
@@ -105,5 +105,5 @@ class QTransformTest(unittest.TestCase):
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtGui/repr_test.py b/sources/pyside6/tests/QtGui/repr_test.py
index 3b732ce77..29c5a9627 100644
--- a/sources/pyside6/tests/QtGui/repr_test.py
+++ b/sources/pyside6/tests/QtGui/repr_test.py
@@ -44,28 +44,34 @@ from PySide6.QtGui import QVector2D, QVector3D, QVector4D
from PySide6.QtGui import QColor, QTransform, QKeySequence, QQuaternion
from PySide6.QtGui import QPolygon
+
class ReprCopyHelper:
def testCopy(self):
copy = eval(self.original.__repr__())
self.assertTrue(copy is not self.original)
self.assertEqual(copy, self.original)
+
class QTransformReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8, 9)
+
class QQuaternionReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QQuaternion(1, 2, 3, 4)
+
class QVector2DReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector2D(1, 2)
+
class QVector3DReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector3D(1, 2, 3)
+
class QVector4DReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector4D(1, 2, 3, 4)
diff --git a/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py b/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py
index 1290fed90..4dcdea57b 100644
--- a/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py
+++ b/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py
@@ -45,13 +45,14 @@ class TestTimedApp(TimedQApplication):
'''Simple test case for TimedQApplication'''
def testFoo(self):
- #Simple test of TimedQApplication
+ # Simple test of TimedQApplication
self.app.exec_()
def fix_for_QtGui(QtGui):
QtGui.something = 42
+
class TestPatchingFramework(unittest.TestCase):
"""Simple test that verifies that deprecated.py works"""
@@ -63,5 +64,6 @@ class TestPatchingFramework(unittest.TestCase):
importhandler.finish_import(QtGui)
self.assertTrue(hasattr(QtGui, something))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtHelp/help_test.py b/sources/pyside6/tests/QtHelp/help_test.py
index 3cb6f51cb..30535a842 100644
--- a/sources/pyside6/tests/QtHelp/help_test.py
+++ b/sources/pyside6/tests/QtHelp/help_test.py
@@ -39,10 +39,12 @@ from PySide6.QtHelp import QHelpEngine
from helper.usesqapplication import UsesQApplication
+
class QHelpEngineCreation(UsesQApplication):
def testConstructor(self):
helpEngine = QHelpEngine('mycollection.qch')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtHelp/helpsearchengine_test.py b/sources/pyside6/tests/QtHelp/helpsearchengine_test.py
index ddde3d308..2cd49314c 100644
--- a/sources/pyside6/tests/QtHelp/helpsearchengine_test.py
+++ b/sources/pyside6/tests/QtHelp/helpsearchengine_test.py
@@ -39,6 +39,7 @@ from PySide6.QtHelp import QHelpEngineCore, QHelpSearchEngine, QHelpSearchResult
from helper.usesqapplication import UsesQApplication
+
class QHelpSearchEngineTest(UsesQApplication):
def testQHelpSearchEngine(self):
@@ -47,5 +48,6 @@ class QHelpSearchEngineTest(UsesQApplication):
helpSearchResult = helpSearchEngine.searchResults(0, 0)
self.assertEqual(len(helpSearchResult), 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtLocation/location.py b/sources/pyside6/tests/QtLocation/location.py
index 03e5c1b24..3bc80f5a3 100644
--- a/sources/pyside6/tests/QtLocation/location.py
+++ b/sources/pyside6/tests/QtLocation/location.py
@@ -46,5 +46,6 @@ class QLocationTestCase(unittest.TestCase):
self.assertEqual(geoServiceProvider.errorString(),
'The geoservices provider none is not supported.')
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtMultimedia/audio_test.py b/sources/pyside6/tests/QtMultimedia/audio_test.py
index 6c9e44e57..102e613ac 100644
--- a/sources/pyside6/tests/QtMultimedia/audio_test.py
+++ b/sources/pyside6/tests/QtMultimedia/audio_test.py
@@ -41,6 +41,7 @@ from helper.usesqguiapplication import UsesQGuiApplication
from PySide6.QtCore import *
from PySide6.QtMultimedia import *
+
class testAudioDevices(UsesQGuiApplication):
def testListDevices(self):
diff --git a/sources/pyside6/tests/QtMultimediaWidgets/qmultimediawidgets.py b/sources/pyside6/tests/QtMultimediaWidgets/qmultimediawidgets.py
index cb5e1b355..ac0b14695 100644
--- a/sources/pyside6/tests/QtMultimediaWidgets/qmultimediawidgets.py
+++ b/sources/pyside6/tests/QtMultimediaWidgets/qmultimediawidgets.py
@@ -42,6 +42,7 @@ from PySide6.QtMultimediaWidgets import QGraphicsVideoItem, QVideoWidget
from PySide6.QtWidgets import QGraphicsScene, QGraphicsView, QVBoxLayout, QWidget
from PySide6.QtCore import QTimer
+
class MyWidget(QWidget):
def __init__(self):
super().__init__()
@@ -54,6 +55,7 @@ class MyWidget(QWidget):
graphicsScene.addItem(QGraphicsVideoItem())
layout.addWidget(graphicsView)
+
class QMultimediaWidgetsTest(UsesQApplication):
def testMultimediaWidgets(self):
w = MyWidget()
@@ -62,5 +64,6 @@ class QMultimediaWidgetsTest(UsesQApplication):
timer = QTimer.singleShot(100, self.app.quit)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtNetwork/accessManager_test.py b/sources/pyside6/tests/QtNetwork/accessManager_test.py
index c7bf00c43..0727400ca 100644
--- a/sources/pyside6/tests/QtNetwork/accessManager_test.py
+++ b/sources/pyside6/tests/QtNetwork/accessManager_test.py
@@ -75,5 +75,6 @@ class AccessManagerCase(UsesQCoreApplication):
self.app.exec_()
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtNetwork/bug_1084.py b/sources/pyside6/tests/QtNetwork/bug_1084.py
index 4d794b8e7..d254313a8 100644
--- a/sources/pyside6/tests/QtNetwork/bug_1084.py
+++ b/sources/pyside6/tests/QtNetwork/bug_1084.py
@@ -48,5 +48,6 @@ class QTcpSocketTestCase(unittest.TestCase):
def testIt(self):
self.sock.write(bytes('quit', "UTF-8"))
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtNetwork/bug_446.py b/sources/pyside6/tests/QtNetwork/bug_446.py
index 7f075c2a3..9d0b7a038 100644
--- a/sources/pyside6/tests/QtNetwork/bug_446.py
+++ b/sources/pyside6/tests/QtNetwork/bug_446.py
@@ -78,5 +78,6 @@ class HttpSignalsCase(UsesQCoreApplication):
self.initServer()
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtNetwork/dnslookup_test.py b/sources/pyside6/tests/QtNetwork/dnslookup_test.py
index 0f6664924..68698f7a5 100644
--- a/sources/pyside6/tests/QtNetwork/dnslookup_test.py
+++ b/sources/pyside6/tests/QtNetwork/dnslookup_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtCore import QCoreApplication
from PySide6.QtNetwork import QDnsLookup
+
class DnsLookupTestCase(unittest.TestCase):
'''Test case for QDnsLookup'''
@@ -62,5 +63,6 @@ class DnsLookupTestCase(unittest.TestCase):
self._lookup.lookup()
self._app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtNetwork/qipv6address_test.py b/sources/pyside6/tests/QtNetwork/qipv6address_test.py
index 10931dcc2..206e7e387 100644
--- a/sources/pyside6/tests/QtNetwork/qipv6address_test.py
+++ b/sources/pyside6/tests/QtNetwork/qipv6address_test.py
@@ -54,5 +54,6 @@ class QIPv6AddressGetItemTest(unittest.TestCase):
ip = QIPv6Address()
self.assertRaises(IndexError, ip.__setitem__, 32, 16)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtNetwork/qpassworddigestor_test.py b/sources/pyside6/tests/QtNetwork/qpassworddigestor_test.py
index 9a7611e42..9e8dbe768 100644
--- a/sources/pyside6/tests/QtNetwork/qpassworddigestor_test.py
+++ b/sources/pyside6/tests/QtNetwork/qpassworddigestor_test.py
@@ -42,11 +42,13 @@ init_test_paths(False)
from PySide6.QtCore import QByteArray, QCryptographicHash
from PySide6.QtNetwork import QPasswordDigestor
+
class TestPasswordDigestor(unittest.TestCase):
def test(self):
b = QPasswordDigestor.deriveKeyPbkdf1(QCryptographicHash.Sha1,
b'test', b'saltnpep', 10, 20)
self.assertEqual(b.size(), 20)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtNetwork/tcpserver_test.py b/sources/pyside6/tests/QtNetwork/tcpserver_test.py
index d19274e13..83eec5660 100644
--- a/sources/pyside6/tests/QtNetwork/tcpserver_test.py
+++ b/sources/pyside6/tests/QtNetwork/tcpserver_test.py
@@ -39,21 +39,23 @@ init_test_paths(False)
from PySide6.QtNetwork import QTcpServer
+
class ListenDefaultArgsCase(unittest.TestCase):
'''Test case for TcpServer.listen with default args'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.server = QTcpServer()
def tearDown(self):
- #Release resources
+ # Release resources
del self.server
def testDefaultArgs(self):
# @bug 108
- #Default arguments for QTcpServer.listen
+ # Default arguments for QTcpServer.listen
self.server.listen()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtNetwork/udpsocket_test.py b/sources/pyside6/tests/QtNetwork/udpsocket_test.py
index 73fcbd7fa..d4a31c044 100644
--- a/sources/pyside6/tests/QtNetwork/udpsocket_test.py
+++ b/sources/pyside6/tests/QtNetwork/udpsocket_test.py
@@ -48,7 +48,7 @@ class HttpSignalsCase(unittest.TestCase):
port, while receiving only the max payload size.'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.called = False
self.app = QCoreApplication([])
@@ -58,7 +58,7 @@ class HttpSignalsCase(unittest.TestCase):
self.server.bind(QHostAddress(QHostAddress.LocalHost), 45454)
def tearDown(self):
- #Release resources
+ # Release resources
del self.socket
del self.server
del self.app
@@ -74,7 +74,7 @@ class HttpSignalsCase(unittest.TestCase):
self.app.quit()
def testDefaultArgs(self):
- #QUdpSocket.readDatagram pythonic return
+ # QUdpSocket.readDatagram pythonic return
# @bug 124
QObject.connect(self.server, SIGNAL('readyRead()'), self.callback)
self.sendPackage()
@@ -82,5 +82,6 @@ class HttpSignalsCase(unittest.TestCase):
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py b/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py
index 7567000c5..98e0a4991 100644
--- a/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py
+++ b/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py
@@ -42,6 +42,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtGui import QOffscreenSurface, QOpenGLContext, QSurface, QWindow
from PySide6.QtOpenGL import QOpenGLBuffer
+
def createSurface(surfaceClass):
if surfaceClass == QSurface.Window:
window = QWindow()
@@ -68,6 +69,7 @@ def createSurface(surfaceClass):
return offscreenSurface
return 0
+
class QOpenGLBufferTest(UsesQApplication):
def testBufferCreate(self):
surface = createSurface(QSurface.Window)
@@ -95,5 +97,6 @@ class QOpenGLBufferTest(UsesQApplication):
ctx.doneCurrent()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py b/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py
index 11720303b..87b0d7e49 100644
--- a/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py
+++ b/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py
@@ -51,6 +51,7 @@ except ImportError:
print("Skipping test due to missing OpenGL module")
sys.exit(0)
+
class OpenGLWindow(QOpenGLWindow):
def __init__(self):
super().__init__()
@@ -72,15 +73,15 @@ class OpenGLWindow(QOpenGLWindow):
self.m_texture = QOpenGLTexture(image)
def paintGL(self):
- GL.glMatrixMode(GL.GL_MODELVIEW);
- GL.glLoadIdentity();
+ GL.glMatrixMode(GL.GL_MODELVIEW)
+ GL.glLoadIdentity()
- GL.glMatrixMode(GL.GL_PROJECTION);
- GL.glLoadIdentity();
- GL.glOrtho(0, 1, 1, 0, -1, 1);
+ GL.glMatrixMode(GL.GL_PROJECTION)
+ GL.glLoadIdentity()
+ GL.glOrtho(0, 1, 1, 0, -1, 1)
self.m_functions.glClear(GL.GL_COLOR_BUFFER_BIT)
- self.m_functions.glEnable(GL.GL_TEXTURE_2D);
+ self.m_functions.glEnable(GL.GL_TEXTURE_2D)
self.m_texture.bind()
d = 0.5
@@ -99,6 +100,7 @@ class OpenGLWindow(QOpenGLWindow):
def resizeGL(self, w, h):
self.m_functions.glViewport(0, 0, self.width(), self.height())
+
class QOpenGLWindowTest(UsesQApplication):
# On macOS, glClear(), glViewport() are rejected due to GLbitfield/GLint not being resolved properly
def test(self):
@@ -108,5 +110,6 @@ class QOpenGLWindowTest(UsesQApplication):
QTimer.singleShot(100, openGlWindow.close)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtPositioning/positioning.py b/sources/pyside6/tests/QtPositioning/positioning.py
index 733aedbc6..9ac066c35 100644
--- a/sources/pyside6/tests/QtPositioning/positioning.py
+++ b/sources/pyside6/tests/QtPositioning/positioning.py
@@ -48,5 +48,6 @@ class QPositioningTestCase(unittest.TestCase):
print(f"QtPositioning source: {name}")
self.assertTrue(name)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtPrintSupport/bug_500.py b/sources/pyside6/tests/QtPrintSupport/bug_500.py
index 51297d659..0e686854d 100644
--- a/sources/pyside6/tests/QtPrintSupport/bug_500.py
+++ b/sources/pyside6/tests/QtPrintSupport/bug_500.py
@@ -46,5 +46,6 @@ class NeverDiesTest(UsesQApplication):
def testIt(self):
QPrintDialog()
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtPrintSupport/returnquadruplesofnumbers_test.py b/sources/pyside6/tests/QtPrintSupport/returnquadruplesofnumbers_test.py
index 26b3cf7f8..b96376cde 100644
--- a/sources/pyside6/tests/QtPrintSupport/returnquadruplesofnumbers_test.py
+++ b/sources/pyside6/tests/QtPrintSupport/returnquadruplesofnumbers_test.py
@@ -41,21 +41,25 @@ from PySide6.QtWidgets import QLayout, QWidget, QGraphicsLayout, QGraphicsLayout
from helper.usesqapplication import UsesQApplication
+
class Layout(QLayout):
def __init__(self):
super().__init__()
+
class GraphicsLayout(QGraphicsLayout):
def __init__(self):
super().__init__()
+
class GraphicsLayoutItem(QGraphicsLayoutItem):
def __init__(self):
super().__init__()
+
class ReturnsQuadruplesOfNumbers(UsesQApplication):
def compareTuples(self, ta, tb):
- for va,vb in zip(ta, tb):
+ for va, vb in zip(ta, tb):
if round(va) != round(vb):
return False
return True
@@ -82,5 +86,5 @@ class ReturnsQuadruplesOfNumbers(UsesQApplication):
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtQml/bug_1029.py b/sources/pyside6/tests/QtQml/bug_1029.py
index 23dc8c26e..c46df7736 100644
--- a/sources/pyside6/tests/QtQml/bug_1029.py
+++ b/sources/pyside6/tests/QtQml/bug_1029.py
@@ -41,13 +41,15 @@ from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import qmlRegisterType
from PySide6.QtQuick import QQuickView, QQuickItem
+
def register_qml_types():
class TestClass(QQuickItem):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickItem.__init__(self, parent)
qmlRegisterType(TestClass, "UserTypes", 1, 0, "TestClass")
+
def main():
app = QGuiApplication([])
@@ -61,5 +63,6 @@ def main():
url = QUrl(__file__.replace(".py", ".qml"))
view.setSource(url)
+
if __name__ == "__main__":
main()
diff --git a/sources/pyside6/tests/QtQml/bug_451.py b/sources/pyside6/tests/QtQml/bug_451.py
index d14f538a7..bfa2eb83e 100644
--- a/sources/pyside6/tests/QtQml/bug_451.py
+++ b/sources/pyside6/tests/QtQml/bug_451.py
@@ -78,6 +78,7 @@ class PythonObject(QObject):
arg1 = Property(int, getArg1, setArg1)
arg2 = Property('QVariant', getArg2, setArg2)
+
class TestBug(unittest.TestCase):
def testQMLFunctionCall(self):
app = QGuiApplication(sys.argv)
diff --git a/sources/pyside6/tests/QtQml/bug_456.py b/sources/pyside6/tests/QtQml/bug_456.py
index 96654808a..270e56ee8 100644
--- a/sources/pyside6/tests/QtQml/bug_456.py
+++ b/sources/pyside6/tests/QtQml/bug_456.py
@@ -57,6 +57,7 @@ class RotateValue(QObject):
rotation = Property(int, getRotation, setRotation)
+
class TestConnectionWithInvalidSignature(TimedQApplication):
def testSlotRetur(self):
@@ -78,5 +79,6 @@ class TestConnectionWithInvalidSignature(TimedQApplication):
button.entered.emit()
self.assertEqual(rotatevalue.rotation, 100)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/bug_726.py b/sources/pyside6/tests/QtQml/bug_726.py
index ee8e77089..f4dd93145 100644
--- a/sources/pyside6/tests/QtQml/bug_726.py
+++ b/sources/pyside6/tests/QtQml/bug_726.py
@@ -79,5 +79,6 @@ class TestConnectionWithInvalidSignature(TimedQApplication):
button.entered.emit()
self.assertEqual(proxy._receivedName, "PySideObject")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/bug_814.py b/sources/pyside6/tests/QtQml/bug_814.py
index f90c8894d..9b5ac7af0 100644
--- a/sources/pyside6/tests/QtQml/bug_814.py
+++ b/sources/pyside6/tests/QtQml/bug_814.py
@@ -52,6 +52,7 @@ from helper.timedqapplication import TimedQApplication
from PySide6.QtCore import QUrl, QAbstractListModel, QModelIndex, Qt
from PySide6.QtQuick import QQuickView
+
class ListModel(QAbstractListModel):
def __init__(self):
super().__init__()
@@ -59,7 +60,7 @@ class ListModel(QAbstractListModel):
def roleNames(self):
return { Qt.DisplayRole: b'pysideModelData' }
- def rowCount(self, parent = QModelIndex()):
+ def rowCount(self, parent=QModelIndex()):
return 3
def data(self, index, role):
@@ -67,6 +68,7 @@ class ListModel(QAbstractListModel):
return 'blubb'
return None
+
class TestBug814(TimedQApplication):
def testAbstractItemModelTransferToQML(self):
view = QQuickView()
@@ -79,6 +81,7 @@ class TestBug814(TimedQApplication):
self.assertTrue(root, quickview_errorstring(view))
view.show()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/bug_825.py b/sources/pyside6/tests/QtQml/bug_825.py
index 039611c70..3deebe6d0 100644
--- a/sources/pyside6/tests/QtQml/bug_825.py
+++ b/sources/pyside6/tests/QtQml/bug_825.py
@@ -45,32 +45,39 @@ from PySide6.QtQuick import QQuickView, QQuickItem, QQuickPaintedItem
paintCalled = False
+
class MetaA(type):
pass
+
class A(object):
__metaclass__ = MetaA
+
MetaB = type(QQuickPaintedItem)
B = QQuickPaintedItem
+
class MetaC(MetaA, MetaB):
pass
+
class C(A, B):
__metaclass__ = MetaC
+
class Bug825 (C):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickPaintedItem.__init__(self, parent)
def paint(self, painter):
global paintCalled
pen = QPen(Qt.black, 2)
- painter.setPen(pen);
- painter.drawPie(self.boundingRect(), 0, 128);
+ painter.setPen(pen)
+ painter.drawPie(self.boundingRect(), 0, 128)
paintCalled = True
+
class TestBug825 (unittest.TestCase):
def testIt(self):
global paintCalled
@@ -88,5 +95,6 @@ class TestBug825 (unittest.TestCase):
app.exec_()
self.assertTrue(paintCalled)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/bug_847.py b/sources/pyside6/tests/QtQml/bug_847.py
index ffa688a32..d4c9f9faf 100644
--- a/sources/pyside6/tests/QtQml/bug_847.py
+++ b/sources/pyside6/tests/QtQml/bug_847.py
@@ -49,6 +49,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtCore import Slot, Signal, QUrl, QTimer, QCoreApplication
from PySide6.QtQuick import QQuickView
+
class View(QQuickView):
def __init__(self):
super().__init__()
@@ -59,6 +60,7 @@ class View(QQuickView):
def blubb(self, x, y):
self.called.emit(x, y)
+
class TestQML(UsesQApplication):
def done(self, x, y):
self._sucess = True
@@ -89,6 +91,7 @@ class TestQML(UsesQApplication):
self.app.exec_()
self.assertTrue(self._sucess)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/bug_915.py b/sources/pyside6/tests/QtQml/bug_915.py
index 7074a503c..312ee341b 100644
--- a/sources/pyside6/tests/QtQml/bug_915.py
+++ b/sources/pyside6/tests/QtQml/bug_915.py
@@ -42,6 +42,7 @@ from helper.timedqapplication import TimedQApplication
from PySide6.QtQuick import QQuickView, QQuickItem
+
class TestBug915(TimedQApplication):
def testReturnPolicy(self):
view = QQuickView()
@@ -49,16 +50,17 @@ class TestBug915(TimedQApplication):
item1 = QQuickItem()
item1.setObjectName("Item1")
item1.setParentItem(view.contentItem())
- self.assertEqual(item1.objectName(), "Item1") # check if the item still valid
+ self.assertEqual(item1.objectName(), "Item1") # check if the item still valid
item2 = QQuickItem()
item2.setObjectName("Item2")
item2.setParentItem(view.contentItem())
item1 = None
- self.assertEqual(item2.objectName(), "Item2") # check if the item still valid
+ self.assertEqual(item2.objectName(), "Item2") # check if the item still valid
view = None
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/bug_926.py b/sources/pyside6/tests/QtQml/bug_926.py
index 6ca5b4170..e8ac50858 100644
--- a/sources/pyside6/tests/QtQml/bug_926.py
+++ b/sources/pyside6/tests/QtQml/bug_926.py
@@ -43,6 +43,7 @@ from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import qmlRegisterType
from PySide6.QtQuick import QQuickView
+
class MyClass (QObject):
def __init__(self):
@@ -52,19 +53,20 @@ class MyClass (QObject):
def getUrl(self):
return self.__url
- def setUrl(self,value):
+ def setUrl(self, value):
newUrl = QUrl(value)
if (newUrl != self.__url):
self.__url = newUrl
self.urlChanged.emit()
urlChanged = Signal()
- urla = Property(QUrl, getUrl, setUrl, notify = urlChanged)
+ urla = Property(QUrl, getUrl, setUrl, notify=urlChanged)
+
class TestBug926 (unittest.TestCase):
def testIt(self):
app = QGuiApplication([])
- qmlRegisterType(MyClass,'Example',1,0,'MyClass')
+ qmlRegisterType(MyClass,'Example', 1, 0, 'MyClass')
view = QQuickView()
file = Path(__file__).resolve().parent / 'bug_926.qml'
self.assertTrue(file.is_file())
@@ -75,5 +77,6 @@ class TestBug926 (unittest.TestCase):
QTimer.singleShot(0, app.quit)
app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/bug_951.py b/sources/pyside6/tests/QtQml/bug_951.py
index fb4eeefca..9a75550a8 100644
--- a/sources/pyside6/tests/QtQml/bug_951.py
+++ b/sources/pyside6/tests/QtQml/bug_951.py
@@ -42,9 +42,11 @@ from PySide6.QtCore import QUrl
from PySide6.QtQml import qmlRegisterType
from PySide6.QtQuick import QQuickItem, QQuickView
+
class MyItem(QQuickItem):
COMPONENT_COMPLETE_CALLED = False
- def __init__(self,parent=None):
+
+ def __init__(self, parent=None):
super().__init__(parent)
self.setObjectName("myitem")
@@ -52,9 +54,10 @@ class MyItem(QQuickItem):
MyItem.COMPONENT_COMPLETE_CALLED = True
super(MyItem, self).componentComplete()
+
class TestRegisterQMLType(TimedQApplication):
def setup(self):
- TimedQApplication.setup(self, 100 * 3) # 3s
+ TimedQApplication.setup(self, 100 * 3) # 3s
def testSignalEmission(self):
qmlRegisterType(MyItem, "my.item", 1, 0, "MyItem")
@@ -68,5 +71,6 @@ class TestRegisterQMLType(TimedQApplication):
self.app.exec_()
self.assertTrue(MyItem.COMPONENT_COMPLETE_CALLED)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/bug_997.py b/sources/pyside6/tests/QtQml/bug_997.py
index ce5ee14db..18fbfcb63 100644
--- a/sources/pyside6/tests/QtQml/bug_997.py
+++ b/sources/pyside6/tests/QtQml/bug_997.py
@@ -61,5 +61,6 @@ class TestBug(UsesQApplication):
self.app.exec_()
self.assertEqual(ownerData.value('newName'), ownerData.value('name'))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/connect_python_qml.py b/sources/pyside6/tests/QtQml/connect_python_qml.py
index 0b1e926cd..c24346620 100644
--- a/sources/pyside6/tests/QtQml/connect_python_qml.py
+++ b/sources/pyside6/tests/QtQml/connect_python_qml.py
@@ -74,5 +74,6 @@ class TestConnectionWithInvalidSignature(TimedQApplication):
self.app.exec_()
self.assertTrue(self.buttonClicked)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/javascript_exceptions.py b/sources/pyside6/tests/QtQml/javascript_exceptions.py
index 6d238b35c..7bb3aa43f 100644
--- a/sources/pyside6/tests/QtQml/javascript_exceptions.py
+++ b/sources/pyside6/tests/QtQml/javascript_exceptions.py
@@ -59,6 +59,7 @@ property_test_string = """
test_1 = False
test_2 = False
+
class TestClass(QObject):
@Slot()
def methodThrows(self):
@@ -77,6 +78,7 @@ class TestClass(QObject):
else:
test_2 = True
+
class JavaScriptExceptionsTest(UsesQApplication):
def test_jsengine(self):
engine = QJSEngine()
@@ -96,7 +98,7 @@ class JavaScriptExceptionsTest(UsesQApplication):
self.assertEqual(result_2.property('name').toString(), 'TypeError')
def test_qml_type(self):
- qmlRegisterType(TestClass, 'JavaScriptExceptions', 1, 0, 'JavaScriptExceptions');
+ qmlRegisterType(TestClass, 'JavaScriptExceptions', 1, 0, 'JavaScriptExceptions')
view = QQuickView()
file = Path(__file__).resolve().parent / 'javascript_exceptions.qml'
diff --git a/sources/pyside6/tests/QtQml/listproperty.py b/sources/pyside6/tests/QtQml/listproperty.py
index 17b9ecce5..0e1e3548f 100644
--- a/sources/pyside6/tests/QtQml/listproperty.py
+++ b/sources/pyside6/tests/QtQml/listproperty.py
@@ -38,12 +38,15 @@ init_test_paths(False)
from PySide6.QtCore import QObject
from PySide6.QtQml import ListProperty
+
class InheritsQObject(QObject):
pass
+
def dummyFunc():
pass
+
class TestListProperty(unittest.TestCase):
def testIt(self):
@@ -84,5 +87,6 @@ class TestListProperty(unittest.TestCase):
self.assertTrue(method_check_error)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py
index 519341b6a..11e666c08 100644
--- a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py
+++ b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py
@@ -45,6 +45,7 @@ from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlIncubationController, VolatileBool
from PySide6.QtQuick import QQuickView
+
class CustomIncubationController(QObject, QQmlIncubationController):
def __init__(self, test):
QObject.__init__(self)
@@ -69,6 +70,7 @@ class CustomIncubationController(QObject, QQmlIncubationController):
# Incubate items for 2000 milliseconds, or until the volatile bool is set to false.
self.incubateWhile(self.incubationShouldContinue, 2000)
+
class TestBug(unittest.TestCase):
def testIncubateWhileCall(self):
app = QGuiApplication(sys.argv)
@@ -101,5 +103,6 @@ class TestBug(unittest.TestCase):
del view
del app
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/qqmlnetwork_test.py b/sources/pyside6/tests/QtQml/qqmlnetwork_test.py
index 35843cf3d..75de98b9e 100644
--- a/sources/pyside6/tests/QtQml/qqmlnetwork_test.py
+++ b/sources/pyside6/tests/QtQml/qqmlnetwork_test.py
@@ -47,14 +47,16 @@ from helper.timedqapplication import TimedQApplication
class CustomManager(QNetworkAccessManager):
- def createRequest(self, op, req, data = None):
+ def createRequest(self, op, req, data=None):
print(">> createRequest ", self, op, req.url(), data)
return QNetworkAccessManager.createRequest(self, op, req, data)
+
class CustomFactory(QQmlNetworkAccessManagerFactory):
- def create(self, parent = None):
+ def create(self, parent=None):
return CustomManager()
+
class TestQQmlNetworkFactory(TimedQApplication):
def setUp(self):
TimedQApplication.setUp(self, timeout=1000)
@@ -76,5 +78,6 @@ class TestQQmlNetworkFactory(TimedQApplication):
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py
index 1b61ddbb0..2843c0a92 100644
--- a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py
+++ b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py
@@ -67,6 +67,7 @@ class TestGrabToSharedPointerImage(TimedQApplication):
self.assertTrue(grabResultSharedPtr)
self.grabbedColor = None
+
def onGrabReady():
# Signal early exit.
QTimer.singleShot(0, self.app.quit)
@@ -81,7 +82,7 @@ class TestGrabToSharedPointerImage(TimedQApplication):
# Get the first pixel color of the grabbed image.
self.image = grabResultSharedPtr.image()
self.assertTrue(self.image)
- self.grabbedColor = self.image.pixelColor(0,0)
+ self.grabbedColor = self.image.pixelColor(0, 0)
self.assertTrue(self.grabbedColor.isValid())
# Compare the grabbed color with the one we set in the rectangle.
diff --git a/sources/pyside6/tests/QtQml/qquickview_test.py b/sources/pyside6/tests/QtQml/qquickview_test.py
index 99b8ab055..9cf9bbabb 100644
--- a/sources/pyside6/tests/QtQml/qquickview_test.py
+++ b/sources/pyside6/tests/QtQml/qquickview_test.py
@@ -44,6 +44,7 @@ from PySide6.QtCore import QUrl, QObject, Property, Slot
from PySide6.QtQml import QQmlEngine
from PySide6.QtQuick import QQuickView
+
class MyObject(QObject):
def __init__(self, text, parent=None):
QObject.__init__(self, parent)
@@ -52,7 +53,6 @@ class MyObject(QObject):
def getText(self):
return self._text
-
@Slot(str)
def qmlText(self, text):
self._qmlText = text
diff --git a/sources/pyside6/tests/QtQml/registersingletontype.py b/sources/pyside6/tests/QtQml/registersingletontype.py
index 90846fc43..01b841675 100644
--- a/sources/pyside6/tests/QtQml/registersingletontype.py
+++ b/sources/pyside6/tests/QtQml/registersingletontype.py
@@ -44,8 +44,9 @@ from PySide6.QtQuick import QQuickView
finalResult = 0
+
class SingletonQObject(QObject):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QObject.__init__(self, parent)
self._data = 100
@@ -58,14 +59,17 @@ class SingletonQObject(QObject):
data = Property(int, getData, setData)
+
def singletonQObjectCallback(engine):
obj = SingletonQObject()
obj.setData(50)
return obj
+
def singletonQJSValueCallback(engine):
return engine.evaluate("new Object({data: 50})")
+
class TestQmlSupport(unittest.TestCase):
def testIt(self):
app = QGuiApplication([])
@@ -86,5 +90,6 @@ class TestQmlSupport(unittest.TestCase):
app.exec_()
self.assertEqual(finalResult, 200)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/registertype.py b/sources/pyside6/tests/QtQml/registertype.py
index cb1208b9c..254208dcb 100644
--- a/sources/pyside6/tests/QtQml/registertype.py
+++ b/sources/pyside6/tests/QtQml/registertype.py
@@ -45,9 +45,10 @@ from PySide6.QtQuick import QQuickView, QQuickItem, QQuickPaintedItem
QML_IMPORT_NAME = "Charts"
QML_IMPORT_MAJOR_VERSION = 1
+
@QmlElement
class PieSlice (QQuickPaintedItem):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickPaintedItem.__init__(self, parent)
self._color = QColor()
self._fromAngle = 0
@@ -78,14 +79,15 @@ class PieSlice (QQuickPaintedItem):
def paint(self, painter):
global paintCalled
pen = QPen(self._color, 2)
- painter.setPen(pen);
- painter.setRenderHints(QPainter.Antialiasing, True);
- painter.drawPie(self.boundingRect(), self._fromAngle * 16, self._angleSpan * 16);
+ painter.setPen(pen)
+ painter.setRenderHints(QPainter.Antialiasing, True)
+ painter.drawPie(self.boundingRect(), self._fromAngle * 16, self._angleSpan * 16)
paintCalled = True
+
@QmlElement
class PieChart (QQuickItem):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickItem.__init__(self, parent)
self._name = ''
self._slices = []
@@ -106,9 +108,11 @@ class PieChart (QQuickItem):
slices = ListProperty(PieSlice, append=appendSlice)
+
appendCalled = False
paintCalled = False
+
class TestQmlSupport(unittest.TestCase):
def testIt(self):
@@ -125,5 +129,6 @@ class TestQmlSupport(unittest.TestCase):
self.assertTrue(appendCalled)
self.assertTrue(paintCalled)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtQml/registeruncreatabletype.py b/sources/pyside6/tests/QtQml/registeruncreatabletype.py
index ce70ab542..6d399b8ae 100644
--- a/sources/pyside6/tests/QtQml/registeruncreatabletype.py
+++ b/sources/pyside6/tests/QtQml/registeruncreatabletype.py
@@ -41,10 +41,11 @@ from PySide6.QtCore import Property, QObject, QUrl
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import qmlRegisterUncreatableType, QQmlEngine, QQmlComponent
-noCreationReason = 'Cannot create an item of type: Uncreatable (expected)';
+noCreationReason = 'Cannot create an item of type: Uncreatable (expected)'
+
class Uncreatable(QObject):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QObject.__init__(self, parent)
self._name = 'uncreatable'
@@ -56,13 +57,14 @@ class Uncreatable(QObject):
name = Property(str, getName, setName)
+
class TestQmlSupport(unittest.TestCase):
def testIt(self):
app = QGuiApplication([])
self.assertTrue(qmlRegisterUncreatableType(Uncreatable, 'Charts', 1, 0,
- 'Uncreatable', noCreationReason) != -1);
+ 'Uncreatable', noCreationReason) != -1)
engine = QQmlEngine()
file = Path(__file__).resolve().parent / 'registeruncreatable.qml'
diff --git a/sources/pyside6/tests/QtQml/signal_arguments.py b/sources/pyside6/tests/QtQml/signal_arguments.py
index b3bd59491..2848a4a6a 100644
--- a/sources/pyside6/tests/QtQml/signal_arguments.py
+++ b/sources/pyside6/tests/QtQml/signal_arguments.py
@@ -41,6 +41,7 @@ from helper.timedqapplication import TimedQApplication
from PySide6.QtQuick import QQuickView
from PySide6.QtCore import QObject, Signal, Slot, QUrl, QTimer, Property
+
class Obj(QObject):
def __init__(self):
super().__init__()
@@ -76,5 +77,6 @@ class TestConnectionWithQml(TimedQApplication):
button.clicked.emit()
self.assertEqual(obj.value, 42)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtScxml/test_dynamic.py b/sources/pyside6/tests/QtScxml/test_dynamic.py
index 18f8c89c8..6c5ae6a35 100644
--- a/sources/pyside6/tests/QtScxml/test_dynamic.py
+++ b/sources/pyside6/tests/QtScxml/test_dynamic.py
@@ -39,6 +39,7 @@ from helper.timedqapplication import TimedQApplication
from PySide6.QtCore import QObject, SIGNAL
from PySide6.QtScxml import QScxmlStateMachine
+
class testDynamicStateMachine(TimedQApplication):
def setUp(self):
super(testDynamicStateMachine, self).setUp()
@@ -55,5 +56,6 @@ class testDynamicStateMachine(TimedQApplication):
def test(self):
self._machine.start()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtSensors/sensors.py b/sources/pyside6/tests/QtSensors/sensors.py
index 101f7fa42..67928b6ec 100644
--- a/sources/pyside6/tests/QtSensors/sensors.py
+++ b/sources/pyside6/tests/QtSensors/sensors.py
@@ -49,7 +49,7 @@ class QSensorTest(unittest.TestCase):
values = []
usedIdentifier = None
for identifier in identifiers:
- sensor = QSensor(sensorType, None);
+ sensor = QSensor(sensorType, None)
sensor.setIdentifier(identifier)
if sensor.connectToBackend():
usedIdentifier = identifier
@@ -60,5 +60,6 @@ class QSensorTest(unittest.TestCase):
if usedIdentifier:
print('Sensor ', sensorType, usedIdentifier, values)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtSerialPort/serial.py b/sources/pyside6/tests/QtSerialPort/serial.py
index 29799a03e..8a7edb078 100644
--- a/sources/pyside6/tests/QtSerialPort/serial.py
+++ b/sources/pyside6/tests/QtSerialPort/serial.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtSerialPort import QSerialPort, QSerialPortInfo
from PySide6.QtCore import QIODevice
+
class QSerialPortTest(unittest.TestCase):
def testDefaultConstructedPort(self):
serialPort = QSerialPort()
@@ -92,5 +93,6 @@ class QSerialPortInfoTest(unittest.TestCase):
portinfo.hasVendorIdentifier()
portinfo.isNull()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtSql/bug_1013.py b/sources/pyside6/tests/QtSql/bug_1013.py
index 50cdce867..17a86876d 100644
--- a/sources/pyside6/tests/QtSql/bug_1013.py
+++ b/sources/pyside6/tests/QtSql/bug_1013.py
@@ -58,10 +58,11 @@ class TestBug1013 (unittest.TestCase):
self._wasCalled = False
model.primeInsert.connect(self.someSlot)
model.select()
- QTimer.singleShot(0,lambda: model.insertRow(0) and app.quit())
+ QTimer.singleShot(0, lambda: model.insertRow(0) and app.quit())
app.exec_()
self.assertTrue(self._wasCalled)
self.assertEqual(model.data(model.index(0, 0)), 2)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py b/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py
index f8d784bdb..6ea020a16 100644
--- a/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py
+++ b/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py
@@ -49,11 +49,12 @@ class Foo(QWidget):
super().__init__()
self.model = QSqlTableModel()
+
class SqlDatabaseCreationDestructionAndQueries(unittest.TestCase):
'''Test cases for QtSql database creation, destruction and queries'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.assertFalse(not QSqlDatabase.drivers(), "installed Qt has no DB drivers")
self.assertTrue("QSQLITE" in QSqlDatabase.drivers(), "\"QSQLITE\" driver not available in this Qt version")
self.db = QSqlDatabase.addDatabase("QSQLITE")
@@ -61,20 +62,20 @@ class SqlDatabaseCreationDestructionAndQueries(unittest.TestCase):
self.assertTrue(self.db.open())
def tearDown(self):
- #Release resources
+ # Release resources
self.db.close()
QSqlDatabase.removeDatabase(":memory:")
del self.db
def testTableCreationAndDestruction(self):
- #Test table creation and destruction
+ # Test table creation and destruction
query = QSqlQuery()
query.exec_("CREATE TABLE dummy(id int primary key, dummyfield varchar(20))")
query.exec_("DROP TABLE dummy")
query.clear()
def testTableInsertionAndRetrieval(self):
- #Test table creation, insertion and retrieval
+ # Test table creation, insertion and retrieval
query = QSqlQuery()
query.exec_("CREATE TABLE person(id int primary key, "
"firstname varchar(20), lastname varchar(20))")
@@ -101,6 +102,7 @@ class SqlDatabaseCreationDestructionAndQueries(unittest.TestCase):
del bar
del app
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtSql/qvarianttype_test.py b/sources/pyside6/tests/QtSql/qvarianttype_test.py
index 6d44de451..2b3dfa4b0 100644
--- a/sources/pyside6/tests/QtSql/qvarianttype_test.py
+++ b/sources/pyside6/tests/QtSql/qvarianttype_test.py
@@ -39,6 +39,7 @@ init_test_paths(False)
from PySide6.QtCore import QMetaType
from PySide6.QtSql import QSqlField
+
class QVariantTypeTest(unittest.TestCase):
def testQVariantType(self):
f = QSqlField("name", QMetaType(QMetaType.QString))
diff --git a/sources/pyside6/tests/QtStateMachine/qabstracttransition_test.py b/sources/pyside6/tests/QtStateMachine/qabstracttransition_test.py
index fa833bda8..6b75d6b32 100644
--- a/sources/pyside6/tests/QtStateMachine/qabstracttransition_test.py
+++ b/sources/pyside6/tests/QtStateMachine/qabstracttransition_test.py
@@ -49,10 +49,12 @@ def addStates(transition):
sy = QState()
transition.setTargetStates([sx, sy])
+
def addAnimation(transition):
animation = QParallelAnimationGroup()
transition.addAnimation(animation)
+
class QAbstractTransitionTest(unittest.TestCase):
def testBasic(self):
@@ -191,5 +193,6 @@ class QAbstractTransitionTest(unittest.TestCase):
self.assertEqual(getrefcount(state1), refcount1 - 1)
self.assertEqual(getrefcount(state2), refcount2 - 1)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtStateMachine/qstate_test.py b/sources/pyside6/tests/QtStateMachine/qstate_test.py
index 9c3ce2ba4..618c8d3e6 100644
--- a/sources/pyside6/tests/QtStateMachine/qstate_test.py
+++ b/sources/pyside6/tests/QtStateMachine/qstate_test.py
@@ -51,10 +51,10 @@ class QStateTest(unittest.TestCase):
machine = QStateMachine()
s1 = QState()
- s1.assignProperty(o, "text", "Rocks");
+ s1.assignProperty(o, "text", "Rocks")
s2 = QFinalState()
- t = s1.addTransition(o, SIGNAL("change()"), s2);
+ t = s1.addTransition(o, SIGNAL("change()"), s2)
self.assertTrue(isinstance(t, QSignalTransition))
machine.addState(s1)
@@ -70,5 +70,6 @@ class QStateTest(unittest.TestCase):
txt = o.property("text")
self.assertTrue(txt, "Rocks")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtStateMachine/setprop_on_ctor_test.py b/sources/pyside6/tests/QtStateMachine/setprop_on_ctor_test.py
index 529a51479..e192a6f63 100644
--- a/sources/pyside6/tests/QtStateMachine/setprop_on_ctor_test.py
+++ b/sources/pyside6/tests/QtStateMachine/setprop_on_ctor_test.py
@@ -42,8 +42,9 @@ from PySide6.QtStateMachine import QEventTransition, QState
class SetPropOnCtorTest(unittest.TestCase):
def testIt(self):
- obj = QEventTransition(targetStates = [QState()])
- self.assertEqual(len(obj.targetStates()), 1);
+ obj = QEventTransition(targetStates=[QState()])
+ self.assertEqual(len(obj.targetStates()), 1)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtSvg/qsvggenerator_test.py b/sources/pyside6/tests/QtSvg/qsvggenerator_test.py
index 3553667a7..c0d94fa17 100644
--- a/sources/pyside6/tests/QtSvg/qsvggenerator_test.py
+++ b/sources/pyside6/tests/QtSvg/qsvggenerator_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QBuffer
from PySide6.QtSvg import QSvgGenerator
+
class QSvgGeneratorTest(unittest.TestCase):
def testRefCountOfTOutputDevice(self):
@@ -66,6 +67,7 @@ class QSvgGeneratorTest(unittest.TestCase):
self.assertEqual(getrefcount(iodevice2), refcount2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py b/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py
index 60ccbabfe..fdc52c063 100644
--- a/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py
+++ b/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py
@@ -41,6 +41,7 @@ from PySide6.QtCore import QFile
from PySide6.QtGui import QGuiApplication
from PySide6.QtSvg import QSvgRenderer
+
class QSvgRendererTest(unittest.TestCase):
def testLoad(self):
@@ -56,6 +57,7 @@ class QSvgRendererTest(unittest.TestCase):
fromContents = QSvgRenderer(tigerData)
self.assertTrue(fromContents.isValid())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py b/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py
index ae8f756ea..00c6bed27 100644
--- a/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py
+++ b/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py
@@ -41,10 +41,11 @@ from PySide6.QtCore import QFile, QFileInfo, QDir
from PySide6.QtWidgets import QApplication
from PySide6.QtSvgWidgets import QSvgWidget
+
class QSvgWidgetTest(unittest.TestCase):
def testLoad(self):
- directory = os.path.dirname(__file__)
+ directory = os.path.dirname(__file__)
tigerPath = QDir.cleanPath(f"{directory}/../QtSvg/tiger.svg")
self.assertTrue(QFileInfo.exists(tigerPath))
@@ -60,6 +61,7 @@ class QSvgWidgetTest(unittest.TestCase):
fromContents.load(tigerData)
self.assertTrue(fromContents.renderer().isValid())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtTest/click_test.py b/sources/pyside6/tests/QtTest/click_test.py
index 77ef0c772..3d027da7a 100644
--- a/sources/pyside6/tests/QtTest/click_test.py
+++ b/sources/pyside6/tests/QtTest/click_test.py
@@ -43,6 +43,7 @@ from PySide6.QtTest import QTest
from helper.usesqapplication import UsesQApplication
+
class MouseClickTest(UsesQApplication):
def testBasic(self):
diff --git a/sources/pyside6/tests/QtTest/eventfilter_test.py b/sources/pyside6/tests/QtTest/eventfilter_test.py
index e84024b0b..b57f13847 100644
--- a/sources/pyside6/tests/QtTest/eventfilter_test.py
+++ b/sources/pyside6/tests/QtTest/eventfilter_test.py
@@ -64,6 +64,7 @@ class KeyEventFilter(QObject):
return False
+
class EventFilterTest(UsesQApplication):
def testKeyEvent(self):
@@ -77,6 +78,5 @@ class EventFilterTest(UsesQApplication):
self.assertTrue(eventFilter.processed)
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtTest/qvalidator_test.py b/sources/pyside6/tests/QtTest/qvalidator_test.py
index eb3ab58d9..a5066de25 100644
--- a/sources/pyside6/tests/QtTest/qvalidator_test.py
+++ b/sources/pyside6/tests/QtTest/qvalidator_test.py
@@ -49,6 +49,7 @@ class MyValidator1(QValidator):
def validate(self, input, pos):
return (QValidator.Acceptable, "fixed", 1)
+
class MyValidator2(QValidator):
def fixup(self, input):
return "fixed"
@@ -56,6 +57,7 @@ class MyValidator2(QValidator):
def validate(self, input, pos):
return (QValidator.Acceptable, "fixed")
+
class MyValidator3(QValidator):
def fixup(self, input):
return "fixed"
@@ -63,6 +65,7 @@ class MyValidator3(QValidator):
def validate(self, input, pos):
return (QValidator.Acceptable,)
+
class MyValidator4(QValidator):
def fixup(self, input):
return "fixed"
@@ -70,6 +73,7 @@ class MyValidator4(QValidator):
def validate(self, input, pos):
return QValidator.Acceptable
+
class MyValidator5(QValidator):
def validate(self, input, pos):
if input.islower():
@@ -80,6 +84,7 @@ class MyValidator5(QValidator):
def fixup(self, input):
return "22"
+
class QValidatorTest(UsesQApplication):
def testValidator1(self):
line = QLineEdit()
@@ -137,5 +142,6 @@ class QValidatorTest(UsesQApplication):
QTest.keyClick(line, Qt.Key_Return)
self.assertEqual(line.text(), "22")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtTest/touchevent_test.py b/sources/pyside6/tests/QtTest/touchevent_test.py
index d3e5f3078..1cf127909 100644
--- a/sources/pyside6/tests/QtTest/touchevent_test.py
+++ b/sources/pyside6/tests/QtTest/touchevent_test.py
@@ -42,8 +42,9 @@ from PySide6.QtCore import QPoint, QTimer, Qt, QEvent
from PySide6.QtGui import QTouchDevice
from PySide6.QtTest import QTest
+
class MyWidget(QWidget):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QWidget.__init__(self, parent)
self._sequence = []
# Fixme (Qt 5): The device needs to be registered (using
diff --git a/sources/pyside6/tests/QtTextToSpeech/qtexttospeech_test.py b/sources/pyside6/tests/QtTextToSpeech/qtexttospeech_test.py
index b2bafef7c..94154f7f6 100644
--- a/sources/pyside6/tests/QtTextToSpeech/qtexttospeech_test.py
+++ b/sources/pyside6/tests/QtTextToSpeech/qtexttospeech_test.py
@@ -49,6 +49,7 @@ except ImportError:
print("Skipping test due to missing QtTextToSpeech module")
sys.exit(0)
+
class QTextToSpeechTestCase(UsesQApplication):
'''Tests related to QTextToSpeech'''
def testSay(self):
@@ -66,5 +67,6 @@ class QTextToSpeechTestCase(UsesQApplication):
if (state == QTextToSpeech.State.Ready):
self.app.quit()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtUiTools/bug_1060.py b/sources/pyside6/tests/QtUiTools/bug_1060.py
index c5d8e61b3..db201f40a 100644
--- a/sources/pyside6/tests/QtUiTools/bug_1060.py
+++ b/sources/pyside6/tests/QtUiTools/bug_1060.py
@@ -47,6 +47,7 @@ class MyQUiLoader(QUiLoader):
def createWidget(self, *args):
return super(MyQUiLoader, self).createWidget(*args)
+
if __name__ == "__main__":
app = QApplication([])
diff --git a/sources/pyside6/tests/QtUiTools/bug_360.py b/sources/pyside6/tests/QtUiTools/bug_360.py
index 230afb965..b4890f0e3 100644
--- a/sources/pyside6/tests/QtUiTools/bug_360.py
+++ b/sources/pyside6/tests/QtUiTools/bug_360.py
@@ -55,6 +55,7 @@ class MyQUiLoader(QUiLoader):
setattr(self.baseinstance, name, widget)
return widget
+
class ButTest(UsesQApplication):
def testCase(self):
w = QWidget()
@@ -66,6 +67,7 @@ class ButTest(UsesQApplication):
self.assertEqual(len(loader._widgets), 1)
self.assertEqual(type(loader._widgets[0]), QFrame)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtUiTools/bug_376.py b/sources/pyside6/tests/QtUiTools/bug_376.py
index 68138731c..f299fabc4 100644
--- a/sources/pyside6/tests/QtUiTools/bug_376.py
+++ b/sources/pyside6/tests/QtUiTools/bug_376.py
@@ -50,6 +50,7 @@ class BugTest(UsesQApplication):
result = loader.load(filePath, w)
self.assertTrue(isinstance(result.child_object, QFrame))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtUiTools/bug_392.py b/sources/pyside6/tests/QtUiTools/bug_392.py
index eb351dedc..0211ad3ba 100644
--- a/sources/pyside6/tests/QtUiTools/bug_392.py
+++ b/sources/pyside6/tests/QtUiTools/bug_392.py
@@ -41,6 +41,7 @@ from PySide6.QtGui import QAction
from PySide6.QtWidgets import QComboBox, QWidget
from PySide6.QtUiTools import QUiLoader
+
class MyWidget(QComboBox):
def __init__(self, parent=None):
QComboBox.__init__(self, parent)
@@ -48,6 +49,7 @@ class MyWidget(QComboBox):
def isPython(self):
return True
+
class BugTest(UsesQApplication):
def testCase(self):
w = QWidget()
@@ -80,6 +82,7 @@ class BugTest(UsesQApplication):
self.assertTrue(isinstance(result.custom2, MyWidget))
self.assertTrue(result.custom.isPython())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtUiTools/bug_426.py b/sources/pyside6/tests/QtUiTools/bug_426.py
index 9f9ca2a1e..3fdc9bec4 100644
--- a/sources/pyside6/tests/QtUiTools/bug_426.py
+++ b/sources/pyside6/tests/QtUiTools/bug_426.py
@@ -50,6 +50,7 @@ class Window(object):
self.widget.show()
QTimer.singleShot(0, self.widget.close)
+
if __name__ == "__main__":
app = QApplication(sys.argv)
win = Window()
diff --git a/sources/pyside6/tests/QtUiTools/bug_552.py b/sources/pyside6/tests/QtUiTools/bug_552.py
index 345dfbac6..d79913424 100644
--- a/sources/pyside6/tests/QtUiTools/bug_552.py
+++ b/sources/pyside6/tests/QtUiTools/bug_552.py
@@ -54,6 +54,7 @@ class View_1(QWidget):
self.t = widget.tabWidget
self.t.removeTab(0)
+
app = QApplication([])
window = View_1()
window.show()
diff --git a/sources/pyside6/tests/QtUiTools/bug_909.py b/sources/pyside6/tests/QtUiTools/bug_909.py
index ce963f31f..96e1d1fa8 100644
--- a/sources/pyside6/tests/QtUiTools/bug_909.py
+++ b/sources/pyside6/tests/QtUiTools/bug_909.py
@@ -41,6 +41,7 @@ from PySide6.QtUiTools import QUiLoader
from helper.usesqapplication import UsesQApplication
+
class TestDestruction(UsesQApplication):
def testBug909(self):
file = Path(__file__).resolve().parent / 'bug_909.ui'
@@ -55,5 +56,6 @@ class TestDestruction(UsesQApplication):
main_win.setCentralWidget(tw)
main_win.show()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtUiTools/bug_913.py b/sources/pyside6/tests/QtUiTools/bug_913.py
index 20c3555ac..9128969d8 100644
--- a/sources/pyside6/tests/QtUiTools/bug_913.py
+++ b/sources/pyside6/tests/QtUiTools/bug_913.py
@@ -51,8 +51,9 @@ class TestBug913 (unittest.TestCase):
file = Path(__file__).resolve().parent / 'bug_913.ui'
self.assertTrue(file.is_file())
widget = loader.load(os.fspath(file))
- widget.tabWidget.currentIndex() # direct child is available as member
- widget.le_first.setText('foo') # child of QTabWidget must also be available!
+ widget.tabWidget.currentIndex() # direct child is available as member
+ widget.le_first.setText('foo') # child of QTabWidget must also be available!
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtUiTools/bug_958.py b/sources/pyside6/tests/QtUiTools/bug_958.py
index 2ef9b4331..74c4a18ea 100644
--- a/sources/pyside6/tests/QtUiTools/bug_958.py
+++ b/sources/pyside6/tests/QtUiTools/bug_958.py
@@ -49,15 +49,17 @@ class Gui_Qt(QMainWindow):
# this used to cause a segfault because the old inject code used to destroy the parent layout
file = Path(__file__).resolve().parent / 'bug_958.ui'
assert(file.is_file())
- self._cw = lLoader.load(os.fspath(file), self)
+ self._cw = lLoader.load(os.fspath(file), self)
self.setCentralWidget(self._cw)
+
class BugTest(TimedQApplication):
def testCase(self):
lMain = Gui_Qt()
lMain.show()
self.app.exec_()
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtUiTools/bug_965.py b/sources/pyside6/tests/QtUiTools/bug_965.py
index 734158f68..92da3312a 100644
--- a/sources/pyside6/tests/QtUiTools/bug_965.py
+++ b/sources/pyside6/tests/QtUiTools/bug_965.py
@@ -39,6 +39,7 @@ from PySide6.QtUiTools import QUiLoader
from helper.usesqapplication import UsesQApplication
+
class MyQUiLoader(QUiLoader):
def __init__(self):
super().__init__()
@@ -46,6 +47,7 @@ class MyQUiLoader(QUiLoader):
def createWidget(self, className, parent=None, name=""):
return None
+
class BugTest(UsesQApplication):
def testCase(self):
loader = MyQUiLoader()
@@ -53,5 +55,6 @@ class BugTest(UsesQApplication):
self.assertTrue(file.is_file())
self.assertRaises(RuntimeError, loader.load, os.fspath(file))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtUiTools/loadUiType_test.py b/sources/pyside6/tests/QtUiTools/loadUiType_test.py
index 1fe30b79e..44de5b6d2 100644
--- a/sources/pyside6/tests/QtUiTools/loadUiType_test.py
+++ b/sources/pyside6/tests/QtUiTools/loadUiType_test.py
@@ -40,6 +40,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QWidget, QFrame, QPushButton
from PySide6.QtUiTools import loadUiType
+
class loadUiTypeTester(UsesQApplication):
def testFunction(self):
filePath = os.path.join(os.path.dirname(__file__), "minimal.ui")
diff --git a/sources/pyside6/tests/QtUiTools/ui_test.py b/sources/pyside6/tests/QtUiTools/ui_test.py
index 70b916b44..553e9192d 100644
--- a/sources/pyside6/tests/QtUiTools/ui_test.py
+++ b/sources/pyside6/tests/QtUiTools/ui_test.py
@@ -39,10 +39,12 @@ from PySide6.QtUiTools import QUiLoader
from helper.usesqapplication import UsesQApplication
+
class QUiLoaderCreation(UsesQApplication):
def testConstructor(self):
loader = QUiLoader()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtUiTools/uiloader_test.py b/sources/pyside6/tests/QtUiTools/uiloader_test.py
index 3e02e41d4..bc0fd93c7 100644
--- a/sources/pyside6/tests/QtUiTools/uiloader_test.py
+++ b/sources/pyside6/tests/QtUiTools/uiloader_test.py
@@ -67,7 +67,6 @@ class QUiLoaderTester(UsesQApplication):
self.assertNotEqual(child, None)
self.assertEqual(w.findChild(QWidget, "grandson_object"), child.findChild(QWidget, "grandson_object"))
-
def testLoadFileOverride(self):
# PYSIDE-1070, override QUiLoader::createWidget() with parent=None crashes
loader = OverridingLoader()
diff --git a/sources/pyside6/tests/QtWebEngine/web_engine_initialize.py b/sources/pyside6/tests/QtWebEngine/web_engine_initialize.py
index 2db107565..df31a87c5 100644
--- a/sources/pyside6/tests/QtWebEngine/web_engine_initialize.py
+++ b/sources/pyside6/tests/QtWebEngine/web_engine_initialize.py
@@ -47,5 +47,6 @@ class MainTest(unittest.TestCase):
QTimer.singleShot(2000, app.quit)
app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWebEngineCore/web_engine_custom_scheme.py b/sources/pyside6/tests/QtWebEngineCore/web_engine_custom_scheme.py
index 936924d19..a51d824fb 100644
--- a/sources/pyside6/tests/QtWebEngineCore/web_engine_custom_scheme.py
+++ b/sources/pyside6/tests/QtWebEngineCore/web_engine_custom_scheme.py
@@ -42,6 +42,7 @@ from PySide6.QtWebEngineWidgets import QWebEngineView, QWebEngineProfile
from PySide6.QtWebEngineCore import (QWebEngineUrlScheme,
QWebEngineUrlSchemeHandler)
+
class TestSchemeHandler(QWebEngineUrlSchemeHandler):
def requestStarted(self, request):
if request.requestUrl() == "testpy:hello":
@@ -57,7 +58,7 @@ class TestSchemeHandler(QWebEngineUrlSchemeHandler):
class MainTest(unittest.TestCase):
def test_SchemeHandlerRedirect(self):
self._loaded = False
- QApplication.setAttribute(Qt.AA_ShareOpenGLContexts);
+ QApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
QtWebEngine.initialize()
app = QApplication([])
diff --git a/sources/pyside6/tests/QtWidgets/action_clear.py b/sources/pyside6/tests/QtWidgets/action_clear.py
index ae5a6988b..f9f416a9c 100644
--- a/sources/pyside6/tests/QtWidgets/action_clear.py
+++ b/sources/pyside6/tests/QtWidgets/action_clear.py
@@ -77,5 +77,6 @@ class TestQActionLifeCycle(UsesQApplication):
toolBar.clear()
self.assertTrue(self._actionDestroyed)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/add_action_test.py b/sources/pyside6/tests/QtWidgets/add_action_test.py
index 1465f5a99..1260f4e17 100644
--- a/sources/pyside6/tests/QtWidgets/add_action_test.py
+++ b/sources/pyside6/tests/QtWidgets/add_action_test.py
@@ -74,6 +74,7 @@ class AddActionTest(UsesQApplication):
action.activate(QAction.Trigger)
self.assertTrue(widget.isChecked())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/api2_test.py b/sources/pyside6/tests/QtWidgets/api2_test.py
index cd60d8a4d..c71de90d3 100644
--- a/sources/pyside6/tests/QtWidgets/api2_test.py
+++ b/sources/pyside6/tests/QtWidgets/api2_test.py
@@ -45,11 +45,13 @@ from PySide6.QtWidgets import QWidget, QSpinBox, QApplication
from helper.usesqapplication import UsesQApplication
+
class WidgetValidatorQInt(QWidget, QIntValidator):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
QIntValidator.__init__(self, parent)
+
class WidgetValidatorQSpinBox(QSpinBox):
def __init__(self, parent=None):
QSpinBox.__init__(self, parent)
@@ -57,6 +59,7 @@ class WidgetValidatorQSpinBox(QSpinBox):
def fixup(self, text):
print("It was called!")
+
class DoubleQObjectInheritanceTest(UsesQApplication):
def testDouble(self):
@@ -64,7 +67,7 @@ class DoubleQObjectInheritanceTest(UsesQApplication):
obj = WidgetValidatorQInt()
- #QIntValidator methods
+ # QIntValidator methods
state, string, number = obj.validate('Test', 0)
self.assertEqual(state, QValidator.Invalid)
state, string, number = obj.validate('33', 0)
@@ -77,11 +80,12 @@ class DoubleQObjectInheritanceTest(UsesQApplication):
obj.setValue(0)
self.assertEqual(obj.value(), 1)
+
class QClipboardTest(UsesQApplication):
def testQClipboard(self):
- #skip this test on MacOS because the clipboard is not available during the ssh session
- #this cause problems in the buildbot
+ # skip this test on macOS because the clipboard is not available during the ssh session
+ # this cause problems in the buildbot
if sys.platform == 'darwin':
return
clip = QApplication.clipboard()
@@ -91,5 +95,6 @@ class QClipboardTest(UsesQApplication):
self.assertEqual(subtype, "plain")
self.assertEqual(text, "Testing this thing!")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/application_test.py b/sources/pyside6/tests/QtWidgets/application_test.py
index 95f36f671..2fea0286b 100644
--- a/sources/pyside6/tests/QtWidgets/application_test.py
+++ b/sources/pyside6/tests/QtWidgets/application_test.py
@@ -41,6 +41,7 @@ from testbinding import TestObject
from PySide6.QtWidgets import QApplication
from PySide6 import __all__ as all
+
class QApplicationInstance(unittest.TestCase):
def appDestroyed(self):
@@ -61,6 +62,7 @@ class QApplicationInstance(unittest.TestCase):
# self.assertEqual(app1, qApp)
app1.destroyed.connect(self.appDestroyed)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_1002.py b/sources/pyside6/tests/QtWidgets/bug_1002.py
index 3bf85e718..ab9cee147 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1002.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1002.py
@@ -39,6 +39,7 @@ from PySide6.QtWidgets import QWidget, QPushButton
from helper.usesqapplication import UsesQApplication
+
class TestBug1002 (UsesQApplication):
def testReturnWindow(self):
widget = QWidget()
@@ -50,5 +51,6 @@ class TestBug1002 (UsesQApplication):
del widget
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_1006.py b/sources/pyside6/tests/QtWidgets/bug_1006.py
index 96231ddc3..7aaff11c1 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1006.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1006.py
@@ -41,6 +41,7 @@ from PySide6.QtWidgets import QDialog, QLabel, QGridLayout, QHBoxLayout, QWidget
from helper.timedqapplication import TimedQApplication
+
class LabelWindow(QDialog):
def __init__(self, parent):
super().__init__(parent)
@@ -51,7 +52,6 @@ class LabelWindow(QDialog):
self.setLayout(self.test_layout)
self._destroyCalled = False
-
def replace(self, unit):
old_item = self.test_layout.itemAtPosition(0, 0)
old_label = old_item.widget()
@@ -69,6 +69,7 @@ class LabelWindow(QDialog):
def _destroyed(self, obj):
self._destroyCalled = True
+
class TestBug1006 (TimedQApplication):
def testLayoutItemLifeTime(self):
@@ -113,5 +114,6 @@ class TestBug1006 (TimedQApplication):
widget.setObjectName("MyWidget")
self.assertEqual(sys.getrefcount(widget), 3)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_1077.py b/sources/pyside6/tests/QtWidgets/bug_1077.py
index 4c35e16bb..8aed4e6f5 100644
--- a/sources/pyside6/tests/QtWidgets/bug_1077.py
+++ b/sources/pyside6/tests/QtWidgets/bug_1077.py
@@ -47,6 +47,7 @@ class Highlighter(QSyntaxHighlighter):
super().__init__(parent)
self.tstamp = time.time()
+
if __name__ == "__main__":
app = QApplication([])
python = QTextEdit()
diff --git a/sources/pyside6/tests/QtWidgets/bug_243.py b/sources/pyside6/tests/QtWidgets/bug_243.py
index 9a551b88d..dea27888c 100644
--- a/sources/pyside6/tests/QtWidgets/bug_243.py
+++ b/sources/pyside6/tests/QtWidgets/bug_243.py
@@ -39,6 +39,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication, QMainWindow, QLayout
+
class QAppPresence(unittest.TestCase):
def testBug(self):
@@ -47,5 +48,6 @@ class QAppPresence(unittest.TestCase):
l = window.layout()
self.assertTrue(isinstance(l, QLayout))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_307.py b/sources/pyside6/tests/QtWidgets/bug_307.py
index 19da5148e..92b0a5973 100644
--- a/sources/pyside6/tests/QtWidgets/bug_307.py
+++ b/sources/pyside6/tests/QtWidgets/bug_307.py
@@ -40,8 +40,8 @@ from PySide6.QtCore import SIGNAL
from PySide6.QtWidgets import QPushButton, QApplication
-class Test (QApplication) :
- def __init__(self, argv) :
+class Test (QApplication):
+ def __init__(self, argv):
super().__init__(argv)
self._called = False
@@ -57,5 +57,6 @@ class QApplicationSignalsTest(unittest.TestCase):
button.click()
self.assertTrue(app._called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_324.py b/sources/pyside6/tests/QtWidgets/bug_324.py
index 2f59b6c23..b3336923f 100644
--- a/sources/pyside6/tests/QtWidgets/bug_324.py
+++ b/sources/pyside6/tests/QtWidgets/bug_324.py
@@ -41,8 +41,8 @@ from PySide6.QtCore import QObject, Signal
from PySide6.QtWidgets import QApplication
-class QBug( QObject ):
- def __init__(self, parent = None):
+class QBug(QObject):
+ def __init__(self, parent=None):
QObject.__init__(self, parent)
def check(self):
@@ -50,6 +50,7 @@ class QBug( QObject ):
done = Signal(str)
+
class Bug324(unittest.TestCase):
def on_done(self, val):
@@ -63,5 +64,6 @@ class Bug324(unittest.TestCase):
bug.check()
self.assertEqual(self.value, 'abc')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_338.py b/sources/pyside6/tests/QtWidgets/bug_338.py
index 329a6746c..c47179473 100644
--- a/sources/pyside6/tests/QtWidgets/bug_338.py
+++ b/sources/pyside6/tests/QtWidgets/bug_338.py
@@ -54,9 +54,10 @@ class BugTest(unittest.TestCase):
scene = QGraphicsScene()
item = DiagramItem()
item2 = DiagramItem()
- #this cause segfault
+ # this cause segfault
scene.addItem(item)
scene.addItem(item2)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_389.py b/sources/pyside6/tests/QtWidgets/bug_389.py
index 3b0ca6a54..4cef736b4 100644
--- a/sources/pyside6/tests/QtWidgets/bug_389.py
+++ b/sources/pyside6/tests/QtWidgets/bug_389.py
@@ -48,5 +48,6 @@ class BugTest(UsesQApplication):
i = s.standardIcon(QStyle.SP_TitleBarMinButton)
self.assertEqual(type(i), QIcon)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_400.py b/sources/pyside6/tests/QtWidgets/bug_400.py
index 7f067a09a..39eafd23a 100644
--- a/sources/pyside6/tests/QtWidgets/bug_400.py
+++ b/sources/pyside6/tests/QtWidgets/bug_400.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QTreeWidgetItemIterator, QTreeWidgetItem, QTreeWidget
+
class BugTest(UsesQApplication):
def testCase(self):
treeWidget = QTreeWidget()
@@ -48,7 +49,7 @@ class BugTest(UsesQApplication):
for i in range(10):
items.append(QTreeWidgetItem(None, [f"item: {i}"]))
- treeWidget.insertTopLevelItems(0, items);
+ treeWidget.insertTopLevelItems(0, items)
_iter = QTreeWidgetItemIterator(treeWidget)
index = 0
while(_iter.value()):
diff --git a/sources/pyside6/tests/QtWidgets/bug_430.py b/sources/pyside6/tests/QtWidgets/bug_430.py
index 7eecd650d..0d3e3a09a 100644
--- a/sources/pyside6/tests/QtWidgets/bug_430.py
+++ b/sources/pyside6/tests/QtWidgets/bug_430.py
@@ -40,9 +40,10 @@ from PySide6.QtWidgets import QApplication, QListView
class ListModel(QAbstractListModel):
- def rowCount(self, parent = QModelIndex()):
+ def rowCount(self, parent=QModelIndex()):
return 0
+
app = QApplication([])
model = ListModel()
v = QListView()
diff --git a/sources/pyside6/tests/QtWidgets/bug_433.py b/sources/pyside6/tests/QtWidgets/bug_433.py
index 0cae07435..0c109f40a 100644
--- a/sources/pyside6/tests/QtWidgets/bug_433.py
+++ b/sources/pyside6/tests/QtWidgets/bug_433.py
@@ -45,6 +45,7 @@ class Test(QGraphicsView):
self.s = QGraphicsScene()
self.setScene(self.s)
+
a = QApplication(sys.argv)
t = Test()
t.show()
diff --git a/sources/pyside6/tests/QtWidgets/bug_467.py b/sources/pyside6/tests/QtWidgets/bug_467.py
index d3bc98230..eaa2696d2 100644
--- a/sources/pyside6/tests/QtWidgets/bug_467.py
+++ b/sources/pyside6/tests/QtWidgets/bug_467.py
@@ -40,8 +40,9 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QMainWindow, QApplication
+
class MyWidget(QMainWindow):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QMainWindow.__init__(self, parent)
@@ -51,5 +52,6 @@ class BugTest(UsesQApplication):
widgets = QApplication.allWidgets()
self.assertTrue(w in widgets)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_493.py b/sources/pyside6/tests/QtWidgets/bug_493.py
index 7a2442f9d..52aae39da 100644
--- a/sources/pyside6/tests/QtWidgets/bug_493.py
+++ b/sources/pyside6/tests/QtWidgets/bug_493.py
@@ -53,5 +53,6 @@ class TestBug493(unittest.TestCase):
self.assertTrue(ev1.matches(ks))
self.assertFalse(ev2.matches(ks))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_512.py b/sources/pyside6/tests/QtWidgets/bug_512.py
index 46dadfa57..d93999833 100644
--- a/sources/pyside6/tests/QtWidgets/bug_512.py
+++ b/sources/pyside6/tests/QtWidgets/bug_512.py
@@ -44,7 +44,7 @@ from PySide6.QtWidgets import QGridLayout, QLabel, QWidget
class BugTest(UsesQApplication):
def testCase(self):
w = QWidget(None)
- lbl = QLabel("Hello", w);
+ lbl = QLabel("Hello", w)
g = QGridLayout()
g.addWidget(lbl, 0, 0)
w.setLayout(g)
@@ -52,7 +52,8 @@ class BugTest(UsesQApplication):
t = g.getItemPosition(0)
self.assertEqual(type(t), tuple)
- self.assertEqual(t, (0,0,1,1))
+ self.assertEqual(t, (0, 0, 1, 1))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_525.py b/sources/pyside6/tests/QtWidgets/bug_525.py
index 573e9bf46..e86c03ba8 100644
--- a/sources/pyside6/tests/QtWidgets/bug_525.py
+++ b/sources/pyside6/tests/QtWidgets/bug_525.py
@@ -38,11 +38,13 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication
from PySide6.QtWidgets import QMenu
+
class M2(QMenu):
- def __init__(self,parent=None):
+ def __init__(self, parent=None):
super().__init__(parent)
self.setTitle(self.tr("M2"))
+
class TestMenuDerivedClass(unittest.TestCase):
def aboutToShowHandler(self):
pass
@@ -53,5 +55,6 @@ class TestMenuDerivedClass(unittest.TestCase):
# Test if the aboutToShow signal was translated to correct type
m2.aboutToShow.connect(self.aboutToShowHandler)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_546.py b/sources/pyside6/tests/QtWidgets/bug_546.py
index 9fece8cd4..4d4f9ed16 100644
--- a/sources/pyside6/tests/QtWidgets/bug_546.py
+++ b/sources/pyside6/tests/QtWidgets/bug_546.py
@@ -47,5 +47,6 @@ class TestBug546(unittest.TestCase):
completer = QCompleter(("foo", "bar"), textEdit)
completer.setWidget(textEdit)
-if __name__=='__main__':
+
+if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_547.py b/sources/pyside6/tests/QtWidgets/bug_547.py
index 0753e932e..984a0c858 100644
--- a/sources/pyside6/tests/QtWidgets/bug_547.py
+++ b/sources/pyside6/tests/QtWidgets/bug_547.py
@@ -44,6 +44,7 @@ from PySide6.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem
class MyMainWindow(unittest.TestCase):
app = QApplication(sys.argv)
+
def testCase1(self):
self._tree = QTreeWidget()
self._tree.setColumnCount(2)
@@ -88,6 +89,7 @@ class MyMainWindow(unittest.TestCase):
self._i11 = QTreeWidgetItem(self._i1, ['11', ])
self.assertEqual(sys.getrefcount(self._i11), 3)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_549.py b/sources/pyside6/tests/QtWidgets/bug_549.py
index dee5d8315..30c56a9a8 100644
--- a/sources/pyside6/tests/QtWidgets/bug_549.py
+++ b/sources/pyside6/tests/QtWidgets/bug_549.py
@@ -47,6 +47,7 @@ class TestBug549(unittest.TestCase):
w.setWindowFrameMargins(5, 6, 7, 8)
self.assertEqual(w.getWindowFrameMargins(), (5, 6, 7, 8))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_569.py b/sources/pyside6/tests/QtWidgets/bug_569.py
index 12809853b..cd4874403 100644
--- a/sources/pyside6/tests/QtWidgets/bug_569.py
+++ b/sources/pyside6/tests/QtWidgets/bug_569.py
@@ -44,11 +44,12 @@ class TestBug569(unittest.TestCase):
types = (QTableWidgetItem, QListWidgetItem, QTreeWidgetItem)
for t in types:
a = t()
- a.__lt__ = lambda other : True
+ a.__lt__ = lambda other: True
b = t()
- b.__lt__ = lambda other : False
+ b.__lt__ = lambda other: False
self.assertTrue(a < b)
self.assertFalse(b < a)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_575.py b/sources/pyside6/tests/QtWidgets/bug_575.py
index d6de17dd1..b7318eded 100644
--- a/sources/pyside6/tests/QtWidgets/bug_575.py
+++ b/sources/pyside6/tests/QtWidgets/bug_575.py
@@ -52,6 +52,7 @@ class Bug575(unittest.TestCase):
selection.cursor.setPosition(2)
self.assertEqual(selection.cursor.position(), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_585.py b/sources/pyside6/tests/QtWidgets/bug_585.py
index eeb89c297..82d581af9 100644
--- a/sources/pyside6/tests/QtWidgets/bug_585.py
+++ b/sources/pyside6/tests/QtWidgets/bug_585.py
@@ -56,6 +56,7 @@ class Bug585(unittest.TestCase):
self.assertEqual(refCount, sys.getrefcount(i1))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_589.py b/sources/pyside6/tests/QtWidgets/bug_589.py
index 48faae17e..6b4afc74b 100644
--- a/sources/pyside6/tests/QtWidgets/bug_589.py
+++ b/sources/pyside6/tests/QtWidgets/bug_589.py
@@ -41,15 +41,17 @@ from PySide6.QtWidgets import QApplication, QGraphicsProxyWidget
class CustomWidget(QGraphicsProxyWidget):
- def itemChange(self, eventType, value):
- QGraphicsProxyWidget.itemChange(self, eventType, value)
+ def itemChange(self, eventType, value):
+ QGraphicsProxyWidget.itemChange(self, eventType, value)
+
class Bug589(unittest.TestCase):
- def testCase(self):
- widget = QGraphicsProxyWidget()
- custom = CustomWidget()
- custom.setParentItem(widget)
+ def testCase(self):
+ widget = QGraphicsProxyWidget()
+ custom = CustomWidget()
+ custom.setParentItem(widget)
+
if __name__ == "__main__":
- app = QApplication(sys.argv)
- unittest.main()
+ app = QApplication(sys.argv)
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_635.py b/sources/pyside6/tests/QtWidgets/bug_635.py
index 7cce5b32a..2def84299 100644
--- a/sources/pyside6/tests/QtWidgets/bug_635.py
+++ b/sources/pyside6/tests/QtWidgets/bug_635.py
@@ -60,6 +60,7 @@ class testQToolBar(unittest.TestCase):
a.trigger()
self.assertTrue(self._called)
+
if __name__ == '__main__':
app = QApplication(sys.argv)
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_640.py b/sources/pyside6/tests/QtWidgets/bug_640.py
index 965adc3a5..b050cf69b 100644
--- a/sources/pyside6/tests/QtWidgets/bug_640.py
+++ b/sources/pyside6/tests/QtWidgets/bug_640.py
@@ -41,7 +41,8 @@ from PySide6.QtWidgets import QStyleOptionGraphicsItem
class Bug640(unittest.TestCase):
def testIt(self):
option = QStyleOptionGraphicsItem()
- a = option.state # crash!?
+ a = option.state # crash!?
+
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_653.py b/sources/pyside6/tests/QtWidgets/bug_653.py
index 47d310a44..3412caa31 100644
--- a/sources/pyside6/tests/QtWidgets/bug_653.py
+++ b/sources/pyside6/tests/QtWidgets/bug_653.py
@@ -46,8 +46,9 @@ class TestBug653(unittest.TestCase):
wizard = QWizard()
page = QWizardPage()
wizard.addPage(page)
- page.wizard() # crash here if the bug still exists due to a circular dependency
+ page.wizard() # crash here if the bug still exists due to a circular dependency
wizard.show()
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_662.py b/sources/pyside6/tests/QtWidgets/bug_662.py
index cc36c6c99..ebc91697b 100644
--- a/sources/pyside6/tests/QtWidgets/bug_662.py
+++ b/sources/pyside6/tests/QtWidgets/bug_662.py
@@ -40,6 +40,7 @@ from PySide6.QtGui import QTextCharFormat
from PySide6.QtWidgets import QTextEdit, QApplication
import sys
+
class testQTextBlock(unittest.TestCase):
def tesIterator(self):
edit = QTextEdit()
@@ -47,8 +48,8 @@ class testQTextBlock(unittest.TestCase):
fmt = QTextCharFormat()
frags = []
for i in range(10):
- fmt.setFontPointSize(i+10)
- frags.append("block%d"%i)
+ fmt.setFontPointSize(i + 10)
+ frags.append(f"block{i}")
cursor.insertText(frags[i], fmt)
doc = edit.document()
@@ -59,6 +60,7 @@ class testQTextBlock(unittest.TestCase):
self.assertEqual(i.fragment().text(), frags[index])
index += 1
+
if __name__ == '__main__':
app = QApplication(sys.argv)
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_667.py b/sources/pyside6/tests/QtWidgets/bug_667.py
index 3cad4e11a..42f9dade3 100644
--- a/sources/pyside6/tests/QtWidgets/bug_667.py
+++ b/sources/pyside6/tests/QtWidgets/bug_667.py
@@ -38,10 +38,12 @@ init_test_paths()
from PySide6.QtCore import QTimer, QPointF
from PySide6.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGraphicsEllipseItem
+
class Ball(QGraphicsEllipseItem):
def __init__(self, d, parent=None):
super().__init__(0, 0, d, d, parent)
- self.vel = QPointF(0,0) #commenting this out prevents the crash
+ self.vel = QPointF(0, 0) #commenting this out prevents the crash
+
class Foo(QGraphicsView):
def __init__(self):
diff --git a/sources/pyside6/tests/QtWidgets/bug_668.py b/sources/pyside6/tests/QtWidgets/bug_668.py
index 167a19ce6..09456756c 100644
--- a/sources/pyside6/tests/QtWidgets/bug_668.py
+++ b/sources/pyside6/tests/QtWidgets/bug_668.py
@@ -53,6 +53,7 @@ class A(QMainWindow):
# Test index() method (see PYSIDE-570, PYSIDE-331)
index = a.index(0, 0, QModelIndex())
+
app = QApplication([])
m = A()
m.show()
diff --git a/sources/pyside6/tests/QtWidgets/bug_674.py b/sources/pyside6/tests/QtWidgets/bug_674.py
index 94ae27212..95e32edd1 100644
--- a/sources/pyside6/tests/QtWidgets/bug_674.py
+++ b/sources/pyside6/tests/QtWidgets/bug_674.py
@@ -51,7 +51,8 @@ class TestBug679(unittest.TestCase):
scene.clear()
self.assertEqual(sys.getrefcount(hello), 2)
self.assertEqual(len(scene.items()), 0)
- self.assertRaises(RuntimeError, hello.isVisible) # the C++ object was deleted
+ self.assertRaises(RuntimeError, hello.isVisible) # the C++ object was deleted
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_688.py b/sources/pyside6/tests/QtWidgets/bug_688.py
index 4b1bfbd73..1120c38f6 100644
--- a/sources/pyside6/tests/QtWidgets/bug_688.py
+++ b/sources/pyside6/tests/QtWidgets/bug_688.py
@@ -41,6 +41,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtGui import QTextFrame, QTextCursor, QTextCharFormat, QFont, QTextFrameFormat
from PySide6.QtWidgets import QTextEdit
+
class BugTest(UsesQApplication):
def testCase(self):
editor = QTextEdit()
@@ -51,7 +52,7 @@ class BugTest(UsesQApplication):
plainCharFormat = QTextCharFormat()
boldCharFormat = QTextCharFormat()
- boldCharFormat.setFontWeight(QFont.Bold);
+ boldCharFormat.setFontWeight(QFont.Bold)
cursor.insertText("""
Text documents are represented by the
QTextDocument class, rather than by QString objects.
@@ -91,16 +92,15 @@ class BugTest(UsesQApplication):
manipulation of the document's contents.""",
plainCharFormat)
-
frame = cursor.currentFrame()
items = []
- #test iterator
+ # test iterator
for i in frame:
items.append(i)
- #test __iadd__
+ # test __iadd__
b = frame.begin()
i = 0
while not b.atEnd():
@@ -109,7 +109,7 @@ class BugTest(UsesQApplication):
b.__iadd__(1)
i += 1
- #test __isub__
+ # test __isub__
b = frame.end()
i = 0
while i > 0:
@@ -119,6 +119,5 @@ class BugTest(UsesQApplication):
i -= 1
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_693.py b/sources/pyside6/tests/QtWidgets/bug_693.py
index 9f5b0f068..dea191aaf 100644
--- a/sources/pyside6/tests/QtWidgets/bug_693.py
+++ b/sources/pyside6/tests/QtWidgets/bug_693.py
@@ -49,6 +49,7 @@ class MyModel (QAbstractListModel):
def data(self, index, role):
return self.stupidLine
+
class TestBug693(unittest.TestCase):
def testIt(self):
app = QApplication([])
@@ -62,6 +63,5 @@ class TestBug693(unittest.TestCase):
MyModel.stupidLine.isNull()
-
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_696.py b/sources/pyside6/tests/QtWidgets/bug_696.py
index f7f4f6d90..e59b87bc0 100644
--- a/sources/pyside6/tests/QtWidgets/bug_696.py
+++ b/sources/pyside6/tests/QtWidgets/bug_696.py
@@ -40,14 +40,17 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QMainWindow, QMenu, QApplication
+
class MainWindow(QMainWindow):
def __init__(self, *args):
- self._menu = QMenu(self.dontexist) # attribute called with invalid C++ object
+ self._menu = QMenu(self.dontexist) # attribute called with invalid C++ object
+
class MainWindow2(QMainWindow):
def __init__(self):
self.show()
+
class Bug696(UsesQApplication):
def testContructorInitialization(self):
self.assertRaises(AttributeError, MainWindow)
diff --git a/sources/pyside6/tests/QtWidgets/bug_711.py b/sources/pyside6/tests/QtWidgets/bug_711.py
index e78fe85b6..9f6217379 100644
--- a/sources/pyside6/tests/QtWidgets/bug_711.py
+++ b/sources/pyside6/tests/QtWidgets/bug_711.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtGui import QAction
from PySide6.QtWidgets import QToolBar, QApplication, QToolButton
+
class TestLabelPixmap(unittest.TestCase):
def testReference(self):
toolbar = QToolBar()
@@ -51,6 +52,7 @@ class TestLabelPixmap(unittest.TestCase):
for b in buttons:
self.assertRaises(RuntimeError, b.objectName)
+
if __name__ == '__main__':
app = QApplication([])
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_722.py b/sources/pyside6/tests/QtWidgets/bug_722.py
index 4a00e035d..968e2c2dd 100644
--- a/sources/pyside6/tests/QtWidgets/bug_722.py
+++ b/sources/pyside6/tests/QtWidgets/bug_722.py
@@ -39,6 +39,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QDoubleSpinBox, QGraphicsBlurEffect
+
class TestSignalConnection(UsesQApplication):
def testFloatSignal(self):
foo1 = QDoubleSpinBox()
@@ -51,9 +52,10 @@ class TestSignalConnection(UsesQApplication):
def testQRealSignal(self):
foo1 = QDoubleSpinBox()
effect = QGraphicsBlurEffect()
- effect.blurRadiusChanged['qreal'].connect(foo1.setValue) # check if qreal is a valid type
+ effect.blurRadiusChanged['qreal'].connect(foo1.setValue) # check if qreal is a valid type
effect.setBlurRadius(0.42)
self.assertAlmostEqual(foo1.value(), effect.blurRadius())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_728.py b/sources/pyside6/tests/QtWidgets/bug_728.py
index 9e1473635..4d1b37593 100644
--- a/sources/pyside6/tests/QtWidgets/bug_728.py
+++ b/sources/pyside6/tests/QtWidgets/bug_728.py
@@ -41,6 +41,8 @@ from PySide6.QtCore import QDir, QTimer
# Periodically check for the file dialog to appear and close it
dialog = None
+
+
def timerHandler():
global dialog
if dialog is not None:
@@ -48,10 +50,11 @@ def timerHandler():
else:
for widget in QApplication.topLevelWidgets():
if isinstance(widget, QDialog) and widget.isVisible():
- dialog = widget
+ dialog = widget
+
app = QApplication([])
-QTimer.singleShot(30000, app.quit) # emergency
+QTimer.singleShot(30000, app.quit) # emergency
timer = QTimer()
timer.setInterval(50)
timer.timeout.connect(timerHandler)
diff --git a/sources/pyside6/tests/QtWidgets/bug_750.py b/sources/pyside6/tests/QtWidgets/bug_750.py
index 1c96e3e1f..111204bf9 100644
--- a/sources/pyside6/tests/QtWidgets/bug_750.py
+++ b/sources/pyside6/tests/QtWidgets/bug_750.py
@@ -41,6 +41,7 @@ from PySide6.QtCore import QTimer
from PySide6.QtGui import QPainter, QFont, QFontInfo
from PySide6.QtWidgets import QWidget
+
class MyWidget(QWidget):
def paintEvent(self, e):
p = QPainter(self)
@@ -57,5 +58,6 @@ class TestQPainter(UsesQApplication):
self.app.exec_()
self.assertTrue(w._info)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_778.py b/sources/pyside6/tests/QtWidgets/bug_778.py
index fc52ce705..5fbbd07fa 100644
--- a/sources/pyside6/tests/QtWidgets/bug_778.py
+++ b/sources/pyside6/tests/QtWidgets/bug_778.py
@@ -39,6 +39,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QTreeWidget, QTreeWidgetItem, QTreeWidgetItemIterator
+
class QTreeWidgetItemIteratorTest(UsesQApplication):
def testWidgetIterator(self):
treeWidget = QTreeWidget()
@@ -53,5 +54,6 @@ class QTreeWidgetItemIteratorTest(UsesQApplication):
self.assertEqual(it.value().text(0), f'item: {index}')
index += 1
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_785.py b/sources/pyside6/tests/QtWidgets/bug_785.py
index 27b552e3c..019dbc0cb 100644
--- a/sources/pyside6/tests/QtWidgets/bug_785.py
+++ b/sources/pyside6/tests/QtWidgets/bug_785.py
@@ -38,11 +38,13 @@ init_test_paths(False)
from PySide6.QtCore import QItemSelection
from PySide6.QtGui import QStandardItemModel, QStandardItem
from PySide6.QtWidgets import QApplication
+
+
class Bug324(unittest.TestCase):
def testOperators(self):
model = QStandardItemModel()
for i in range(100):
- model.appendRow(QStandardItem("Item: %d"%i))
+ model.appendRow(QStandardItem(f"Item: {i}"))
first = model.index(0, 0)
second = model.index(10, 0)
@@ -53,12 +55,13 @@ class Bug324(unittest.TestCase):
sel2 = QItemSelection()
sel2.select(third, fourth)
- sel3 = sel + sel2 #check operator +
+ sel3 = sel + sel2 # check operator +
self.assertEqual(len(sel3), 2)
sel4 = sel
- sel4 += sel2 #check operator +=
+ sel4 += sel2 # check operator +=
self.assertEqual(len(sel4), 2)
self.assertEqual(sel4, sel3)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_793.py b/sources/pyside6/tests/QtWidgets/bug_793.py
index 08c060f15..40e3f85da 100644
--- a/sources/pyside6/tests/QtWidgets/bug_793.py
+++ b/sources/pyside6/tests/QtWidgets/bug_793.py
@@ -38,27 +38,32 @@ init_test_paths(False)
from PySide6.QtCore import QTimer
from PySide6.QtWidgets import QWidget, QApplication
+
class TestW1(QWidget):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
super().__init__(parent)
TestW2(parent, self)
+
class TestW2(QWidget):
- def __init__(self, ancestor, parent = None):
+ def __init__(self, ancestor, parent=None):
super().__init__(parent)
self.ancestor_ref = ancestor
+
class Test(QWidget):
def __init__(self):
super().__init__()
TestW1(self)
+
class TestQApplicationDestrcutor(unittest.TestCase):
def testDestructor(self):
w = Test()
w.show()
QTimer.singleShot(0, w.close)
+
if __name__ == '__main__':
app = QApplication(sys.argv)
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_811.py b/sources/pyside6/tests/QtWidgets/bug_811.py
index cde5f2fe9..38fbd652c 100644
--- a/sources/pyside6/tests/QtWidgets/bug_811.py
+++ b/sources/pyside6/tests/QtWidgets/bug_811.py
@@ -41,11 +41,13 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtGui import QTextBlockUserData, QTextCursor
from PySide6.QtWidgets import QTextEdit
+
class TestUserData(QTextBlockUserData):
def __init__(self, data):
super().__init__()
self.data = data
+
class TestUserDataRefCount(UsesQApplication):
def testRefcount(self):
textedit = QTextEdit()
@@ -63,5 +65,6 @@ class TestUserDataRefCount(UsesQApplication):
del ud, ud2
self.assertEqual(sys.getrefcount(self.udata()), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_834.py b/sources/pyside6/tests/QtWidgets/bug_834.py
index 3a3926359..a8a6ab107 100644
--- a/sources/pyside6/tests/QtWidgets/bug_834.py
+++ b/sources/pyside6/tests/QtWidgets/bug_834.py
@@ -43,6 +43,7 @@ class Window(QMainWindow):
def childEvent(self, event):
super(Window, self).childEvent(event)
+
app = QApplication([])
window = Window()
diff --git a/sources/pyside6/tests/QtWidgets/bug_836.py b/sources/pyside6/tests/QtWidgets/bug_836.py
index 4523c525c..fe381a570 100644
--- a/sources/pyside6/tests/QtWidgets/bug_836.py
+++ b/sources/pyside6/tests/QtWidgets/bug_836.py
@@ -42,16 +42,20 @@ from PySide6.QtWidgets import QApplication, QFrame
class Mixin1(object):
pass
+
class Mixin2(object):
pass
+
class Mixin3(object):
pass
+
class MainWindow(Mixin1, Mixin2, Mixin3, QFrame):
def __init__(self):
super().__init__()
+
def main():
app = QApplication([])
# if it doesn't crash it should pass
@@ -60,6 +64,7 @@ def main():
QTimer.singleShot(0, w.close)
app.exec_()
+
if __name__ == "__main__":
main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_844.py b/sources/pyside6/tests/QtWidgets/bug_844.py
index 879c08850..e6167dfc6 100644
--- a/sources/pyside6/tests/QtWidgets/bug_844.py
+++ b/sources/pyside6/tests/QtWidgets/bug_844.py
@@ -47,6 +47,7 @@ class QtKeyPressListener(QObject):
# This used to crash here due to a misbehaviour of type discovery!
return QObject.eventFilter(self, obj, event)
+
app = QApplication([])
key_listener = QtKeyPressListener(app)
w = QLabel('Hello')
diff --git a/sources/pyside6/tests/QtWidgets/bug_854.py b/sources/pyside6/tests/QtWidgets/bug_854.py
index 6ce2b653e..5c88237b5 100644
--- a/sources/pyside6/tests/QtWidgets/bug_854.py
+++ b/sources/pyside6/tests/QtWidgets/bug_854.py
@@ -56,7 +56,7 @@ class VirtualList(QAbstractItemModel):
return self.createIndex(row, column)
def parent(self, index):
- return QModelIndex()
+ return QModelIndex()
def data(self, index, role):
row = index.row()
@@ -73,6 +73,7 @@ class TestQAbstractItemModel(UsesQApplication):
table.show()
self.assertFalse(model._getItemCalled)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_860.py b/sources/pyside6/tests/QtWidgets/bug_860.py
index 4a208257a..b5ce9419d 100644
--- a/sources/pyside6/tests/QtWidgets/bug_860.py
+++ b/sources/pyside6/tests/QtWidgets/bug_860.py
@@ -40,6 +40,7 @@ from PySide6.QtWidgets import QCheckBox
from helper.usesqapplication import UsesQApplication
+
class MultipleSlotTest(UsesQApplication):
def cb_changed(self, i):
self._changed = True
@@ -65,5 +66,6 @@ class MultipleSlotTest(UsesQApplication):
box.setChecked(True)
self.assertTrue(self._changed)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_862.py b/sources/pyside6/tests/QtWidgets/bug_862.py
index 643b338e7..d16357081 100644
--- a/sources/pyside6/tests/QtWidgets/bug_862.py
+++ b/sources/pyside6/tests/QtWidgets/bug_862.py
@@ -66,18 +66,22 @@ class MyQObject(QObject):
def __init__(self):
super().__init__()
+
class MyQWidget(QWidget):
def __init__(self):
super().__init__()
+
class MyQGraphicsObject(QGraphicsObject):
def __init__(self):
super().__init__()
+
class MyQGraphicsItem(QGraphicsItem):
def __init__(self):
super().__init__()
+
class TestRepr (unittest.TestCase):
def testIt(self):
@@ -94,5 +98,6 @@ class TestRepr (unittest.TestCase):
self.assertEqual("<PySide6.QtWidgets.QWidget(0x", repr(QWidget())[:29])
self.assertEqual("<PySide6.QtWidgets.QGraphicsWidget(0x", repr(QGraphicsWidget())[:37])
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_871.py b/sources/pyside6/tests/QtWidgets/bug_871.py
index 758d3ece4..487f46494 100644
--- a/sources/pyside6/tests/QtWidgets/bug_871.py
+++ b/sources/pyside6/tests/QtWidgets/bug_871.py
@@ -43,11 +43,11 @@ from PySide6.QtWidgets import QLineEdit
class BlankIntValidator(QIntValidator):
- def validate(self,input,pos):
+ def validate(self, input, pos):
if input == '':
return QValidator.Acceptable, input, pos
else:
- return QIntValidator.validate(self,input,pos)
+ return QIntValidator.validate(self, input, pos)
class Bug871Test(UsesQApplication):
@@ -74,5 +74,5 @@ class Bug871Test(UsesQApplication):
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_879.py b/sources/pyside6/tests/QtWidgets/bug_879.py
index 4089fa590..8a7b4b184 100644
--- a/sources/pyside6/tests/QtWidgets/bug_879.py
+++ b/sources/pyside6/tests/QtWidgets/bug_879.py
@@ -39,10 +39,12 @@ from PySide6.QtCore import QCoreApplication, QTimer, QEvent, Qt
from PySide6.QtWidgets import QApplication, QSpinBox
from PySide6.QtGui import QKeyEvent
+
class MySpinBox(QSpinBox):
- def validate(self,text,pos):
- return QSpinBox.validate(self,text,pos)
+ def validate(self, text, pos):
+ return QSpinBox.validate(self, text, pos)
+
class TestBug879 (unittest.TestCase):
@@ -61,5 +63,6 @@ class TestBug879 (unittest.TestCase):
ev = QKeyEvent(QEvent.KeyPress, Qt.Key_A, Qt.NoModifier, 'a')
QCoreApplication.sendEvent(self.box, ev)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_919.py b/sources/pyside6/tests/QtWidgets/bug_919.py
index fd51ec9ef..f4d5311fd 100644
--- a/sources/pyside6/tests/QtWidgets/bug_919.py
+++ b/sources/pyside6/tests/QtWidgets/bug_919.py
@@ -40,8 +40,9 @@ from PySide6.QtCore import Signal, QTimer
from PySide6.QtGui import QPainter
from PySide6.QtWidgets import QPushButton, QStyleOptionButton, QApplication, QStyle
+
class MyWidget(QPushButton):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QPushButton.__init__(self, parent)
self._painted = False
@@ -58,6 +59,7 @@ class MyWidget(QPushButton):
paintReceived = Signal()
+
class TestBug919(TimedQApplication):
def setUp(self):
TimedQApplication.setUp(self, 2000)
@@ -69,5 +71,6 @@ class TestBug919(TimedQApplication):
self.app.exec_()
self.assertTrue(w._painted)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_921.py b/sources/pyside6/tests/QtWidgets/bug_921.py
index 9c7924efb..d27ce774d 100644
--- a/sources/pyside6/tests/QtWidgets/bug_921.py
+++ b/sources/pyside6/tests/QtWidgets/bug_921.py
@@ -47,6 +47,7 @@ class Signaller(QObject):
s2 = Signal()
s3 = Signal()
+
class Window(object):
def __init__(self, s):
@@ -64,6 +65,7 @@ class Window(object):
def _on_signal(self):
self._window.setWindowTitle("Signaled!")
+
class TestTimedApp(TimedQApplication):
def testSignals(self):
s = Signaller()
@@ -83,5 +85,6 @@ class TestTimedApp(TimedQApplication):
s.s2.emit()
s.s3.emit()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_941.py b/sources/pyside6/tests/QtWidgets/bug_941.py
index 459659931..6f200b281 100644
--- a/sources/pyside6/tests/QtWidgets/bug_941.py
+++ b/sources/pyside6/tests/QtWidgets/bug_941.py
@@ -42,13 +42,15 @@ from PySide6.QtWidgets import QApplication, QHeaderView
def foo(a, b):
pass
+
class TestBug941 (unittest.TestCase):
def testIt(self):
app = QApplication([])
view = QHeaderView(Qt.Horizontal)
self.assertTrue(view.sortIndicatorChanged.connect(foo))
- view.sortIndicatorChanged.emit(0, Qt.Vertical) # this can't raise an exception!
+ view.sortIndicatorChanged.emit(0, Qt.Vertical) # this can't raise an exception!
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_964.py b/sources/pyside6/tests/QtWidgets/bug_964.py
index 8a3ea9434..fdf74e324 100644
--- a/sources/pyside6/tests/QtWidgets/bug_964.py
+++ b/sources/pyside6/tests/QtWidgets/bug_964.py
@@ -46,10 +46,11 @@ class TestBug964 (unittest.TestCase):
model = QStringListModel(["1", "2"])
view = QListView()
view.setModel(model)
- view.setCurrentIndex(model.index(0,0))
+ view.setCurrentIndex(model.index(0, 0))
newCursor = view.moveCursor(QAbstractItemView.MoveDown, Qt.NoModifier)
self.assertEqual(newCursor.row(), 1)
self.assertEqual(newCursor.column(), 0)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_967.py b/sources/pyside6/tests/QtWidgets/bug_967.py
index b86715002..a27a046d3 100644
--- a/sources/pyside6/tests/QtWidgets/bug_967.py
+++ b/sources/pyside6/tests/QtWidgets/bug_967.py
@@ -51,5 +51,6 @@ class TestBug967 (unittest.TestCase):
obj.currentIndexChanged.emit(5)
self.assertEqual(self.arg, 5)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_972.py b/sources/pyside6/tests/QtWidgets/bug_972.py
index 12110edee..24f892f19 100644
--- a/sources/pyside6/tests/QtWidgets/bug_972.py
+++ b/sources/pyside6/tests/QtWidgets/bug_972.py
@@ -40,6 +40,7 @@ from PySide6.QtWidgets import QGraphicsProxyWidget, QSizePolicy, QPushButton, QG
from helper.timedqapplication import TimedQApplication
+
def createItem(minimum, preferred, maximum, name):
w = QGraphicsProxyWidget()
@@ -51,6 +52,7 @@ def createItem(minimum, preferred, maximum, name):
return w
+
class TestBug972 (TimedQApplication):
# Test if the function QGraphicsProxyWidget.setWidget have the correct behavior
diff --git a/sources/pyside6/tests/QtWidgets/bug_979.py b/sources/pyside6/tests/QtWidgets/bug_979.py
index aa2a610a6..e6607d260 100644
--- a/sources/pyside6/tests/QtWidgets/bug_979.py
+++ b/sources/pyside6/tests/QtWidgets/bug_979.py
@@ -37,9 +37,10 @@ init_test_paths()
from PySide6.QtWidgets import QDialog
from import_test import PysideImportTest2
+
class PysideImportTest1(QDialog, PysideImportTest2):
- pass
+ pass
+
if __name__ == '__main__':
quit()
-
diff --git a/sources/pyside6/tests/QtWidgets/bug_988.py b/sources/pyside6/tests/QtWidgets/bug_988.py
index 9d3f0398d..02bc9f741 100644
--- a/sources/pyside6/tests/QtWidgets/bug_988.py
+++ b/sources/pyside6/tests/QtWidgets/bug_988.py
@@ -51,5 +51,6 @@ class TestBug988 (unittest.TestCase):
obj.currentChanged.emit(5)
self.assertEqual(self.arg, 5)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/bug_998.py b/sources/pyside6/tests/QtWidgets/bug_998.py
index 735de74bc..0cea3296b 100644
--- a/sources/pyside6/tests/QtWidgets/bug_998.py
+++ b/sources/pyside6/tests/QtWidgets/bug_998.py
@@ -37,10 +37,12 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication
+
class TestBug998 (unittest.TestCase):
def testNoFocusWindow(self):
widget = QApplication.focusWidget()
self.assertTrue(widget == None)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/customproxywidget_test.py b/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
index d63391125..db4da7884 100644
--- a/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
@@ -41,10 +41,12 @@ from PySide6.QtGui import QPainter
from PySide6.QtWidgets import QLabel
from PySide6.QtWidgets import QGraphicsScene, QGraphicsView, QGraphicsItem, QGraphicsProxyWidget
+
class CustomProxy(QGraphicsProxyWidget):
def __init__(self, parent=None, wFlags=0):
QGraphicsProxyWidget.__init__(self, parent, wFlags)
+
class CustomProxyWidgetTest(UsesQApplication):
def testCustomProxyWidget(self):
scene = QGraphicsScene()
@@ -57,13 +59,14 @@ class CustomProxyWidgetTest(UsesQApplication):
scene.setSceneRect(scene.itemsBoundingRect())
view = QGraphicsView(scene)
- view.setRenderHints(QPainter.Antialiasing|QPainter.SmoothPixmapTransform)
+ view.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate)
view.show()
timer = QTimer.singleShot(100, self.app.quit)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/event_filter_test.py b/sources/pyside6/tests/QtWidgets/event_filter_test.py
index 37333506f..aee5a2926 100644
--- a/sources/pyside6/tests/QtWidgets/event_filter_test.py
+++ b/sources/pyside6/tests/QtWidgets/event_filter_test.py
@@ -39,11 +39,12 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtCore import QObject, QEvent
from PySide6.QtWidgets import QWidget
+
class MyFilter(QObject):
- def eventFilter(self, obj, event):
- if event.type() == QEvent.KeyPress:
- pass
- return QObject.eventFilter(self, obj, event)
+ def eventFilter(self, obj, event):
+ if event.type() == QEvent.KeyPress:
+ pass
+ return QObject.eventFilter(self, obj, event)
class EventFilter(UsesQApplication):
@@ -69,5 +70,6 @@ class EventFilter(UsesQApplication):
w = None
self.assertTrue(True)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/grandparent_method_test.py b/sources/pyside6/tests/QtWidgets/grandparent_method_test.py
index b1a8742d0..67d56e156 100644
--- a/sources/pyside6/tests/QtWidgets/grandparent_method_test.py
+++ b/sources/pyside6/tests/QtWidgets/grandparent_method_test.py
@@ -41,17 +41,20 @@ from PySide6.QtWidgets import QPushButton, QWidget
from helper.usesqapplication import UsesQApplication
+
class Dummy(QPushButton):
def show(self):
QWidget.show(self)
self.called = True
+
class GrandParentMethod(UsesQApplication):
def testMethod(self):
obj = Dummy()
obj.show()
self.assertTrue(obj.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/hashabletype_test.py b/sources/pyside6/tests/QtWidgets/hashabletype_test.py
index 93eba5486..4a56a1045 100644
--- a/sources/pyside6/tests/QtWidgets/hashabletype_test.py
+++ b/sources/pyside6/tests/QtWidgets/hashabletype_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QTreeWidgetItem
from helper.usesqapplication import UsesQApplication
+
class HashableTest(UsesQApplication):
def testQTreeWidgetItemHash(self):
@@ -48,6 +49,7 @@ class HashableTest(UsesQApplication):
h[obj] = 2
self.assertTrue(h.get(obj), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/keep_reference_test.py b/sources/pyside6/tests/QtWidgets/keep_reference_test.py
index 87ab45ec4..1766f16ee 100644
--- a/sources/pyside6/tests/QtWidgets/keep_reference_test.py
+++ b/sources/pyside6/tests/QtWidgets/keep_reference_test.py
@@ -46,13 +46,17 @@ from PySide6.QtWidgets import QTableView
class TestModel(QAbstractTableModel):
def __init__(self, parent=None):
QAbstractTableModel.__init__(self, parent)
+
def rowCount(self, parent):
return 0
+
def columnCount(self, parent):
return 0
+
def data(self, index, role):
return None
+
class KeepReferenceTest(UsesQApplication):
def testModelWithoutParent(self):
@@ -106,6 +110,7 @@ class KeepReferenceTest(UsesQApplication):
createModelAndSetToView(view)
model = view.model()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/missing_symbols_test.py b/sources/pyside6/tests/QtWidgets/missing_symbols_test.py
index a4b0cb12d..d30f77fc5 100644
--- a/sources/pyside6/tests/QtWidgets/missing_symbols_test.py
+++ b/sources/pyside6/tests/QtWidgets/missing_symbols_test.py
@@ -40,26 +40,29 @@ init_test_paths(False)
from PySide6 import QtGui
from PySide6 import QtWidgets
+
class MissingClasses(unittest.TestCase):
- def testQDrag(self): # Bug 222
+ def testQDrag(self): # Bug 222
getattr(QtGui, 'QDrag')
- def testQDropEvent(self): # Bug 255
+ def testQDropEvent(self): # Bug 255
getattr(QtGui, 'QDropEvent')
+
class MissingMembers(unittest.TestCase):
- def testQFontMetricsSize(self): # Bug 223
+ def testQFontMetricsSize(self): # Bug 223
QtGui.QFontMetrics.size
- def testQLayoutSetSpacing(self): # Bug 231
+ def testQLayoutSetSpacing(self): # Bug 231
QtWidgets.QLayout.setSpacing
- def testQImageLoad(self): # Bug 257
+ def testQImageLoad(self): # Bug 257
QtGui.QImage.load
- def testQStandardItemModelinsertRow(self): # Bug 227
+ def testQStandardItemModelinsertRow(self): # Bug 227
QtGui.QStandardItemModel.insertRow
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/paint_event_test.py b/sources/pyside6/tests/QtWidgets/paint_event_test.py
index ed5c56eee..48d999901 100644
--- a/sources/pyside6/tests/QtWidgets/paint_event_test.py
+++ b/sources/pyside6/tests/QtWidgets/paint_event_test.py
@@ -42,11 +42,12 @@ from PySide6.QtWidgets import QApplication, QWidget
from helper.usesqapplication import UsesQApplication
+
class MyWidget(QWidget):
'''Sample widget'''
def __init__(self, app=None):
- #Creates a new widget
+ # Creates a new widget
if app is None:
app = QApplication([])
@@ -57,7 +58,7 @@ class MyWidget(QWidget):
self.paint_event_called = False
def timerEvent(self, event):
- #Timer event method
+ # Timer event method
self.runs += 1
if self.runs == self.max_runs:
@@ -67,7 +68,7 @@ class MyWidget(QWidget):
raise TypeError('Invalid event type. Must be QTimerEvent')
def paintEvent(self, event):
- #Empty paint event method
+ # Empty paint event method
# XXX: should be using super here, but somehow PyQt4
# complains about paintEvent not present in super
QWidget.paintEvent(self, event)
@@ -80,17 +81,17 @@ class PaintEventOverride(UsesQApplication):
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(PaintEventOverride, self).setUp()
self.widget = MyWidget(self.app)
def tearDown(self):
- #Release resources
+ # Release resources
del self.widget
super(PaintEventOverride, self).tearDown()
def testPaintEvent(self):
- #Test QWidget.paintEvent override
+ # Test QWidget.paintEvent override
timer_id = self.widget.startTimer(100)
self.widget.show()
self.app.exec_()
diff --git a/sources/pyside6/tests/QtWidgets/parent_method_test.py b/sources/pyside6/tests/QtWidgets/parent_method_test.py
index 56b109531..4f2ab2f9a 100644
--- a/sources/pyside6/tests/QtWidgets/parent_method_test.py
+++ b/sources/pyside6/tests/QtWidgets/parent_method_test.py
@@ -43,8 +43,10 @@ class Foo(QTableView):
def __init__(self, parent=None):
QTableView.__init__(self, parent)
+
from helper.usesqapplication import UsesQApplication
+
class TestParentType(UsesQApplication):
def testParentType(self):
@@ -56,5 +58,6 @@ class TestParentType(UsesQApplication):
self.assertTrue(isinstance(w2.parentWidget(), Foo))
self.assertTrue(isinstance(w2.parent(), Foo))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/private_mangle_test.py b/sources/pyside6/tests/QtWidgets/private_mangle_test.py
index bfa11c350..94bbfa231 100644
--- a/sources/pyside6/tests/QtWidgets/private_mangle_test.py
+++ b/sources/pyside6/tests/QtWidgets/private_mangle_test.py
@@ -55,6 +55,7 @@ from PySide6.QtCore import Signal
from PySide6.QtWidgets import QApplication, QWidget
from PySide6 import QtWidgets
+
class Harness(QWidget):
clicked = Signal()
diff --git a/sources/pyside6/tests/QtWidgets/python_properties_test.py b/sources/pyside6/tests/QtWidgets/python_properties_test.py
index 4c90dce28..72adc7517 100644
--- a/sources/pyside6/tests/QtWidgets/python_properties_test.py
+++ b/sources/pyside6/tests/QtWidgets/python_properties_test.py
@@ -51,5 +51,6 @@ class Properties(unittest.TestCase):
# PSYIDE-304, can assign to a "const QWidget *" field
p.widget = None
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py b/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py
index 7bbdedadd..b6d443bdb 100644
--- a/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py
@@ -40,6 +40,7 @@ from PySide6.QtGui import QTextFormat, QTextCharFormat, QPyTextObject
from PySide6.QtWidgets import QTextEdit
from helper.usesqapplication import UsesQApplication
+
class Foo(QPyTextObject):
called = False
@@ -50,6 +51,7 @@ class Foo(QPyTextObject):
def drawObject(self, painter, rect, doc, posInDocument, format):
pass
+
class QAbstractTextDocumentLayoutTest(UsesQApplication):
objectType = QTextFormat.UserObject + 1
@@ -76,6 +78,7 @@ class QAbstractTextDocumentLayoutTest(UsesQApplication):
self.assertTrue(Foo.called)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qaction_test.py b/sources/pyside6/tests/QtWidgets/qaction_test.py
index 42130a598..6f9b1afec 100644
--- a/sources/pyside6/tests/QtWidgets/qaction_test.py
+++ b/sources/pyside6/tests/QtWidgets/qaction_test.py
@@ -39,6 +39,7 @@ from PySide6.QtGui import QAction
from PySide6.QtWidgets import QWidget
from helper.usesqapplication import UsesQApplication
+
class QPainterDrawText(UsesQApplication):
def _cb(self):
@@ -72,6 +73,7 @@ class SetShortcutTest(UsesQApplication):
s2 = action.shortcut()
self.assertEqual(s2, shortcut)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qapp_test.py b/sources/pyside6/tests/QtWidgets/qapp_test.py
index 0455cdb61..dec6034f1 100644
--- a/sources/pyside6/tests/QtWidgets/qapp_test.py
+++ b/sources/pyside6/tests/QtWidgets/qapp_test.py
@@ -43,12 +43,14 @@ from PySide6.QtWidgets import QApplication
class QAppPresence(unittest.TestCase):
def testQApp(self):
- #QtGui.qApp variable is instance of QApplication
+ # QtGui.qApp variable is instance of QApplication
self.assertTrue(isinstance(qApp, QApplication))
+
def main():
app = QApplication([])
unittest.main()
+
if __name__ == '__main__':
main()
diff --git a/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py b/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
index 4008aa743..57b1e410a 100644
--- a/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
+++ b/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py
@@ -37,14 +37,16 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication, QPushButton, QWidget, QSpinBox
+
class QApplicationDelete(unittest.TestCase):
'''Test for segfault when deleting a QApplication before a QWidget'''
def testQPushButton(self):
- #QApplication deleted before QPushButton
+ # QApplication deleted before QPushButton
a = QApplication([])
b = QPushButton('aaaa')
del a
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qapplication_test.py b/sources/pyside6/tests/QtWidgets/qapplication_test.py
index 4c5c56dfa..4d62f8179 100644
--- a/sources/pyside6/tests/QtWidgets/qapplication_test.py
+++ b/sources/pyside6/tests/QtWidgets/qapplication_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication
+
class TestQApplication(unittest.TestCase):
def testNoArguments(self):
app = QApplication()
diff --git a/sources/pyside6/tests/QtWidgets/qbrush_test.py b/sources/pyside6/tests/QtWidgets/qbrush_test.py
index 838bfc9e5..2083a6c56 100644
--- a/sources/pyside6/tests/QtWidgets/qbrush_test.py
+++ b/sources/pyside6/tests/QtWidgets/qbrush_test.py
@@ -43,11 +43,12 @@ from PySide6.QtWidgets import QApplication
from helper.usesqapplication import UsesQApplication
+
class Constructor(UsesQApplication):
'''Test case for constructor of QBrush'''
def testQColor(self):
- #QBrush(QColor) constructor
+ # QBrush(QColor) constructor
color = QColor('black')
obj = QBrush(color)
self.assertEqual(obj.color(), color)
@@ -55,5 +56,6 @@ class Constructor(UsesQApplication):
obj = QBrush(Qt.blue)
self.assertEqual(obj.color(), Qt.blue)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qdynamic_signal.py b/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
index d1fe42151..89caf2906 100644
--- a/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
+++ b/sources/pyside6/tests/QtWidgets/qdynamic_signal.py
@@ -40,6 +40,7 @@ from PySide6.QtWidgets import QInputDialog
from helper.usesqapplication import UsesQApplication
+
class DynamicSignalTest(UsesQApplication):
def cb(self, obj):
diff --git a/sources/pyside6/tests/QtWidgets/qfontdialog_test.py b/sources/pyside6/tests/QtWidgets/qfontdialog_test.py
index 59c5dca3b..c503873ad 100644
--- a/sources/pyside6/tests/QtWidgets/qfontdialog_test.py
+++ b/sources/pyside6/tests/QtWidgets/qfontdialog_test.py
@@ -46,11 +46,11 @@ class TestFontDialog(TimedQApplication):
QFontDialog.getFont()
def testGetFontQDialog(self):
- QFontDialog.getFont(QFont("FreeSans",10))
+ QFontDialog.getFont(QFont("FreeSans", 10))
def testGetFontQDialogQString(self):
- QFontDialog.getFont(QFont("FreeSans",10), None, "Select font")
+ QFontDialog.getFont(QFont("FreeSans", 10), None, "Select font")
+
if __name__ == '__main__':
unittest.main()
-
diff --git a/sources/pyside6/tests/QtWidgets/qformlayout_test.py b/sources/pyside6/tests/QtWidgets/qformlayout_test.py
index 15cb7432f..1bb89d61c 100644
--- a/sources/pyside6/tests/QtWidgets/qformlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qformlayout_test.py
@@ -39,6 +39,7 @@ from PySide6.QtWidgets import QFormLayout, QWidget
from helper.usesqapplication import UsesQApplication
+
class QFormLayoutTest(UsesQApplication):
def testGetItemPosition(self):
@@ -88,5 +89,5 @@ class QFormLayoutTest(UsesQApplication):
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py
index ed9485d0d..2ee6cd96f 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py
@@ -62,5 +62,6 @@ class QGraphicsViewIsBlockedTest(UsesQApplication):
(first, second) = Item().isBlockedByModalPanel()
self.assertFalse(first)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
index 583a54709..4ce395e0e 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py
@@ -42,11 +42,12 @@ from PySide6.QtWidgets import QGraphicsScene
from helper.usesqapplication import UsesQApplication
+
class QColorOnSetBrush(UsesQApplication):
'''Test case for passing a QColor directly to setBrush'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(QColorOnSetBrush, self).setUp()
self.scene = QGraphicsScene()
@@ -55,16 +56,17 @@ class QColorOnSetBrush(UsesQApplication):
self.color = QColor('black')
def tearDown(self):
- #Release resources
+ # Release resources
del self.color
del self.item
del self.scene
super(QColorOnSetBrush, self).tearDown()
def testQColor(self):
- #QGraphicsAbstractShapeItem.setBrush(QColor)
+ # QGraphicsAbstractShapeItem.setBrush(QColor)
self.item.setBrush(self.color)
self.assertEqual(QBrush(self.color), self.item.brush())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py
index f7ec876bb..92d89b44d 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py
@@ -42,6 +42,7 @@ from PySide6.QtCore import QRectF
from helper.usesqapplication import UsesQApplication
+
class GObjA(QGraphicsObject):
def paint(self, *args):
pass
@@ -52,6 +53,7 @@ class GObjA(QGraphicsObject):
def itemChange(self, *args):
return QGraphicsObject.itemChange(self, *args)
+
class GObjB(QGraphicsObject):
def paint(self, *args):
pass
@@ -59,6 +61,7 @@ class GObjB(QGraphicsObject):
def boundingRect(self):
return QRectF()
+
class QGraphicsObjectReimpl(UsesQApplication):
'''Test case for reimplementing QGraphicsObject'''
@@ -79,5 +82,6 @@ class QGraphicsObjectReimpl(UsesQApplication):
gobjB.setParentItem(w)
self.assertIs(type(w), type(gobjB.parentItem()))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
index b4e62bc13..ef78f83f7 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
@@ -41,6 +41,7 @@ from PySide6.QtGui import QPainter
from PySide6.QtWidgets import QLabel
from PySide6.QtWidgets import QGraphicsScene, QGraphicsView, QGraphicsItem, QGraphicsProxyWidget
+
class QGraphicsProxyWidgetTest(UsesQApplication):
def testQGraphicsProxyWidget(self):
scene = QGraphicsScene()
@@ -53,13 +54,14 @@ class QGraphicsProxyWidgetTest(UsesQApplication):
scene.setSceneRect(scene.itemsBoundingRect())
view = QGraphicsView(scene)
- view.setRenderHints(QPainter.Antialiasing|QPainter.SmoothPixmapTransform)
+ view.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate)
view.show()
timer = QTimer.singleShot(100, self.app.quit)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
index 54e81c45c..b8a5a3945 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py
@@ -50,19 +50,22 @@ from PySide6.QtWidgets import QGraphicsProxyWidget, QGraphicsView
from helper.usesqapplication import UsesQApplication
+
class Constructor(unittest.TestCase):
'''QGraphicsScene constructor'''
def testConstructor(self):
- #QGraphicsScene constructor
+ # QGraphicsScene constructor
obj = QGraphicsScene()
self.assertTrue(isinstance(obj, QGraphicsScene))
# Test for PYSIDE-868: Test whether painter.device() can be accessed
# correctly. This was crashing when the underlying QPaintDevice was a
# QWidget due to handling multiple inheritance incorrectly.
+
+
class CustomScene(QGraphicsScene):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
super().__init__(parent)
self.dpi = 0
@@ -72,24 +75,25 @@ class CustomScene(QGraphicsScene):
def drawForeground(self, painter, rect):
self.dpi = painter.device().physicalDpiX()
+
class ConstructorWithRect(unittest.TestCase):
'''QGraphicsScene qrect constructor and related sizes'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
# PyQt4 doesn't accept a QRect as argument to constructor
self.scene = QGraphicsScene(0, 200, 150, 175)
def tearDown(self):
- #Release resources
+ # Release resources
del self.scene
def testHeight(self):
- #QGraphicsScene.height()
+ # QGraphicsScene.height()
self.assertEqual(self.scene.height(), 175)
def testWidth(self):
- #QGraphicsScene.width()
+ # QGraphicsScene.width()
self.assertEqual(self.scene.width(), 150)
@@ -99,60 +103,60 @@ class AddItem(UsesQApplication):
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(AddItem, self).setUp()
self.scene = QGraphicsScene()
# While the scene does not inherits from QWidget, requires
# an application to make the internals work.
def tearDown(self):
- #Release resources
+ # Release resources
del self.scene
super(AddItem, self).tearDown()
def testEllipse(self):
- #QGraphicsScene.addEllipse
+ # QGraphicsScene.addEllipse
item = self.scene.addEllipse(100, 100, 100, 100)
self.assertTrue(isinstance(item, QGraphicsEllipseItem))
def testLine(self):
- #QGraphicsScene.addLine
+ # QGraphicsScene.addLine
item = self.scene.addLine(100, 100, 200, 200)
self.assertTrue(isinstance(item, QGraphicsLineItem))
def testPath(self):
- #QGraphicsScene.addPath
+ # QGraphicsScene.addPath
item = self.scene.addPath(QPainterPath())
self.assertTrue(isinstance(item, QGraphicsPathItem))
def testPixmap(self):
- #QGraphicsScene.addPixmap
+ # QGraphicsScene.addPixmap
item = self.scene.addPixmap(QPixmap())
self.assertTrue(isinstance(item, QGraphicsPixmapItem))
def testPolygon(self):
- #QGraphicsScene.addPolygon
+ # QGraphicsScene.addPolygon
points = [QPointF(0, 0), QPointF(100, 100), QPointF(0, 100)]
item = self.scene.addPolygon(QPolygonF(points))
self.assertTrue(isinstance(item, QGraphicsPolygonItem))
def testRect(self):
- #QGraphicsScene.addRect
+ # QGraphicsScene.addRect
item = self.scene.addRect(100, 100, 100, 100)
self.assertTrue(isinstance(item, QGraphicsRectItem))
def testSimpleText(self):
- #QGraphicsScene.addSimpleText
+ # QGraphicsScene.addSimpleText
item = self.scene.addSimpleText('Monty Python 42')
self.assertTrue(isinstance(item, QGraphicsSimpleTextItem))
def testText(self):
- #QGraphicsScene.addText
+ # QGraphicsScene.addText
item = self.scene.addText('Monty Python 42')
self.assertTrue(isinstance(item, QGraphicsTextItem))
def testWidget(self):
- #QGraphicsScene.addWidget
+ # QGraphicsScene.addWidget
# XXX: printing some X11 error when using under PyQt4
item = self.scene.addWidget(QPushButton())
self.assertTrue(isinstance(item, QGraphicsProxyWidget))
@@ -164,7 +168,7 @@ class ItemRetrieve(UsesQApplication):
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(ItemRetrieve, self).setUp()
self.scene = QGraphicsScene()
@@ -174,29 +178,30 @@ class ItemRetrieve(UsesQApplication):
self.bottomright = QGraphicsRectItem(100, 100, 100, 100)
self.items = [self.topleft, self.topright, self.bottomleft,
- self.bottomright]
+ self.bottomright]
for item in self.items:
self.scene.addItem(item)
def tearDown(self):
- #Release resources
+ # Release resources
del self.scene
super(ItemRetrieve, self).tearDown()
def testItems(self):
- #QGraphicsScene.items()
+ # QGraphicsScene.items()
items = self.scene.items()
for i in items:
self.assertTrue(i in self.items)
def testItemAt(self):
- #QGraphicsScene.itemAt()
+ # QGraphicsScene.itemAt()
self.assertEqual(self.scene.itemAt(50, 50, QTransform()), self.topleft)
self.assertEqual(self.scene.itemAt(150, 50, QTransform()), self.topright)
self.assertEqual(self.scene.itemAt(50, 150, QTransform()), self.bottomleft)
self.assertEqual(self.scene.itemAt(150, 150, QTransform()), self.bottomright)
+
class TestGraphicsGroup(UsesQApplication):
def testIt(self):
scene = QGraphicsScene()
@@ -207,17 +212,17 @@ class TestGraphicsGroup(UsesQApplication):
i4 = QGraphicsRectItem()
group = scene.createItemGroup((i2, i3, i4))
scene.removeItem(i1)
- del i1 # this shouldn't delete i2
+ del i1 # this shouldn't delete i2
self.assertEqual(i2.scene(), scene)
scene.destroyItemGroup(group)
self.assertRaises(RuntimeError, group.type)
- def testCustomScene(self): # For PYSIDE-868, see above
+ def testCustomScene(self): # For PYSIDE-868, see above
scene = CustomScene()
view = QGraphicsView(scene)
view.show()
while scene.dpi == 0:
- QApplication.instance().processEvents()
+ QApplication.processEvents()
view.hide()
diff --git a/sources/pyside6/tests/QtWidgets/qimage_test.py b/sources/pyside6/tests/QtWidgets/qimage_test.py
index 73c8ba4ce..216126df9 100644
--- a/sources/pyside6/tests/QtWidgets/qimage_test.py
+++ b/sources/pyside6/tests/QtWidgets/qimage_test.py
@@ -274,6 +274,7 @@ xpm = [
". ( A ~+{+]+^+l > /+D f.c q . + . . + + . + + + + + + "
]
+
class QImageTest(UsesQApplication):
'''Test case for calling setPixel with float as argument'''
@@ -307,6 +308,7 @@ class QImageTest(UsesQApplication):
self.assertEqual(img.width(), 27)
self.assertEqual(img.height(), 22)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py b/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py
index df3307d77..c558e291b 100644
--- a/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py
+++ b/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py
@@ -53,7 +53,8 @@ class TestInputDialog(TimedQApplication):
def testGetText(self):
(text, bool) = QInputDialog.getText(None, "title", "label")
- self.assertEqual(str(text),"")
+ self.assertEqual(str(text), "")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py b/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py
index 61f56f2d2..cd629430f 100644
--- a/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py
+++ b/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py
@@ -42,6 +42,7 @@ from PySide6.QtWidgets import QKeySequenceEdit
from helper.usesqapplication import UsesQApplication
+
class QKeySequenceEditTest(UsesQApplication):
def testKeySequence(self):
keySequenceEdit = QKeySequenceEdit()
@@ -50,5 +51,6 @@ class QKeySequenceEditTest(UsesQApplication):
self.app.exec_()
print(keySequenceEdit.keySequence())
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qlabel_test.py b/sources/pyside6/tests/QtWidgets/qlabel_test.py
index 15618eec7..b8bbb2902 100644
--- a/sources/pyside6/tests/QtWidgets/qlabel_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlabel_test.py
@@ -43,6 +43,7 @@ from shiboken6 import Shiboken
from helper.usesqapplication import UsesQApplication
+
class QLabelTest(UsesQApplication):
'''Test case for calling QLabel.setPixmap'''
@@ -62,7 +63,6 @@ class QLabelTest(UsesQApplication):
self.label.setPixmap(p1)
self.assertIsNotNone(self.label.pixmap())
-
# PYSIDE-150:
# When a new QPixmap is assigned to a QLabel,
# the previous one needs to be cleared.
@@ -85,5 +85,6 @@ class QLabelTest(UsesQApplication):
self.assertTrue(all(Shiboken.getCppPointer(o) != ret_p_addr
for o in Shiboken.getAllValidWrappers()))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py b/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
index d10141098..255119562 100644
--- a/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py
@@ -44,6 +44,7 @@ from PySide6.QtWidgets import QApplication, QPushButton, QLabel
from helper.usesqapplication import UsesQApplication
+
class SaveReference(UsesQApplication):
'''Test case to check if QLayout-derived classes increment the refcount
of widgets passed to addWidget()'''
@@ -52,19 +53,19 @@ class SaveReference(UsesQApplication):
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(SaveReference, self).setUp()
self.widget1 = QPushButton('click me')
self.widget2 = QLabel('aaa')
def tearDown(self):
- #Release resources
+ # Release resources
del self.widget2
del self.widget1
super(SaveReference, self).tearDown()
def checkLayoutReference(self, layout):
- #Checks the reference cound handling of layout.addWidget
+ # Checks the reference cound handling of layout.addWidget
self.assertEqual(getrefcount(self.widget1), 2)
layout.addWidget(self.widget1)
self.assertEqual(getrefcount(self.widget1), 3)
@@ -86,32 +87,32 @@ class SaveReference(UsesQApplication):
w.setLayout(l)
self.assertEqual(getrefcount(self.widget1), 3)
-
def testHBoxReference(self):
- #QHBoxLayout.addWidget reference count
+ # QHBoxLayout.addWidget reference count
w = QWidget()
self.checkLayoutReference(QHBoxLayout(w))
def testVBoxReference(self):
- #QVBoxLayout.addWidget reference count
+ # QVBoxLayout.addWidget reference count
w = QWidget()
self.checkLayoutReference(QVBoxLayout(w))
def testGridReference(self):
- #QGridLayout.addWidget reference count
+ # QGridLayout.addWidget reference count
w = QWidget()
self.checkLayoutReference(QGridLayout(w))
def testFormReference(self):
- #QFormLayout.addWidget reference count
+ # QFormLayout.addWidget reference count
w = QWidget()
self.checkLayoutReference(QFormLayout(w))
def testStackedReference(self):
- #QStackedLayout.addWidget reference count
+ # QStackedLayout.addWidget reference count
w = QWidget()
self.checkLayoutReference(QStackedLayout(w))
+
class MultipleAdd(UsesQApplication):
'''Test case to check if refcount is incremented only once when multiple
calls to addWidget are made with the same widget'''
@@ -119,21 +120,21 @@ class MultipleAdd(UsesQApplication):
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(MultipleAdd, self).setUp()
self.widget = QPushButton('click me')
self.win = QWidget()
self.layout = QHBoxLayout(self.win)
def tearDown(self):
- #Release resources
+ # Release resources
del self.widget
del self.layout
del self.win
super(MultipleAdd, self).tearDown()
def testRefCount(self):
- #Multiple QLayout.addWidget calls on the same widget
+ # Multiple QLayout.addWidget calls on the same widget
self.assertEqual(getrefcount(self.widget), 2)
self.layout.addWidget(self.widget)
self.assertEqual(getrefcount(self.widget), 3)
@@ -142,6 +143,7 @@ class MultipleAdd(UsesQApplication):
self.layout.addWidget(self.widget)
self.assertEqual(getrefcount(self.widget), 3)
+
class InternalAdd(UsesQApplication):
def testInternalRef(self):
mw = QWidget()
diff --git a/sources/pyside6/tests/QtWidgets/qlayout_test.py b/sources/pyside6/tests/QtWidgets/qlayout_test.py
index 012d84da1..fa5e53e4f 100644
--- a/sources/pyside6/tests/QtWidgets/qlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlayout_test.py
@@ -64,6 +64,7 @@ class MyLayout(QLayout):
def add(self, item):
self._list.append(item)
+
class MissingItemAtLayout(QLayout):
def __init__(self, parent=None):
QLayout.__init__(self, parent)
@@ -81,10 +82,11 @@ class MissingItemAtLayout(QLayout):
def add(self, item):
self._list.append(item)
-#Test if a layout implemented in python, the QWidget.setLayout works
-#fine because this implement som layout functions used in glue code of
-#QWidget, then in c++ when call a virtual function this need call the QLayout
-#function implemented in python
+# Test if a layout implemented in python, the QWidget.setLayout works
+# fine because this implement som layout functions used in glue code of
+# QWidget, then in c++ when call a virtual function this need call the QLayout
+# function implemented in python
+
class QLayoutTest(UsesQApplication):
def testOwnershipTransfer(self):
@@ -97,12 +99,11 @@ class QLayoutTest(UsesQApplication):
w = QWidget()
- #transfer ref
+ # transfer ref
w.setLayout(l)
self.assertEqual(sys.getrefcount(b), 3)
-
def testReferenceTransfer(self):
b = QPushButton("teste")
l = QHBoxLayout()
@@ -144,5 +145,6 @@ class QLayoutTest(UsesQApplication):
del w
self.assertRaises(RuntimeError, spacer.isEmpty)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py b/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py
index 55b289e2c..fb7c4b578 100644
--- a/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QApplication, QLCDNumber
+
class QLCDNumberOverflow(unittest.TestCase):
'''Test case for unhandled overflow on QLCDNumber() numDigits argument (see bug #215).'''
@@ -47,5 +48,6 @@ class QLCDNumberOverflow(unittest.TestCase):
# NOTE: PyQt4 raises TypeError, but boost.python raises OverflowError
self.assertRaises(OverflowError, QLCDNumber, 840835495615213080)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qlistwidget_test.py b/sources/pyside6/tests/QtWidgets/qlistwidget_test.py
index 5ca2507e9..64fc2f181 100644
--- a/sources/pyside6/tests/QtWidgets/qlistwidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlistwidget_test.py
@@ -48,7 +48,7 @@ class QListWidgetTest(UsesQApplication):
item = QListWidgetItem("item0")
item.setData(Qt.UserRole, o)
- #item._data = o
+ # item._data = o
self.assertTrue(sys.getrefcount(o), 3)
self.assertTrue(sys.getrefcount(item), 2)
lst.addItem(item)
@@ -79,7 +79,7 @@ class QListWidgetTest(UsesQApplication):
def testIt(self):
lst = QListWidget()
lst.show()
- slot = lambda : lst.removeItemWidget(lst.currentItem())
+ slot = lambda: lst.removeItemWidget(lst.currentItem())
lst.addItem(QListWidgetItem("foo"))
QTimer.singleShot(0, slot)
QTimer.singleShot(0, lst.close)
@@ -93,5 +93,6 @@ class QListWidgetTest(UsesQApplication):
self.assertIsNone(lst.clear())
self.assertRaises(RuntimeError, lambda: item.text())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py b/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
index 7cfbfe3d1..5bfdcf496 100644
--- a/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py
@@ -59,5 +59,6 @@ class QListWidgetItemConstructor(UsesQApplication):
# Bug 452 - QListWidgetItem() not casting NoneType to null correctly.
item = QListWidgetItem(None, 123)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qmainwindow_test.py b/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
index 4ed726eb4..017ffbbd0 100644
--- a/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
+++ b/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
@@ -52,6 +52,7 @@ class MainWindow(QMainWindow):
pointerToolbar = self.addToolBar("Pointer type")
pointerToolbar.addWidget(pointerButton)
+
class MyButton(QPushButton):
def __init__(self, parent=None):
super().__init__()
diff --git a/sources/pyside6/tests/QtWidgets/qmenu_test.py b/sources/pyside6/tests/QtWidgets/qmenu_test.py
index 20d43069b..0033cd35d 100644
--- a/sources/pyside6/tests/QtWidgets/qmenu_test.py
+++ b/sources/pyside6/tests/QtWidgets/qmenu_test.py
@@ -41,6 +41,7 @@ from PySide6.QtCore import SLOT
from helper.usesqapplication import UsesQApplication
+
class QMenuAddAction(UsesQApplication):
def setUp(self):
@@ -53,17 +54,18 @@ class QMenuAddAction(UsesQApplication):
def testAddActionWithoutKeySequenceCallable(self):
# bug #280
- action = self.menu.addAction(self.app.tr('aaa'), lambda : 1)
+ action = self.menu.addAction(self.app.tr('aaa'), lambda: 1)
def testAddActionKeySequenceCallable(self):
# bug #228
- action = self.menu.addAction(self.app.tr('aaa'), lambda : 1,
+ action = self.menu.addAction(self.app.tr('aaa'), lambda: 1,
QKeySequence(self.app.tr('Ctrl+O')))
def testAddActionKeySequenceSlot(self):
action = self.menu.addAction('Quit', self.app, SLOT('quit()'),
QKeySequence('Ctrl+O'))
+
class QMenuAddActionWithIcon(UsesQApplication):
def setUp(self):
@@ -78,16 +80,17 @@ class QMenuAddActionWithIcon(UsesQApplication):
def testAddActionWithoutKeySequenceCallable(self):
# bug #280
- action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda : 1)
+ action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda: 1)
def testAddActionKeySequenceCallable(self):
# bug #228
- action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda : 1,
+ action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda: 1,
QKeySequence(self.app.tr('Ctrl+O')))
def testAddActionKeySequenceSlot(self):
action = self.menu.addAction(self.icon, 'Quit', self.app, SLOT('quit()'),
QKeySequence('Ctrl+O'))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qmenuadd_test.py b/sources/pyside6/tests/QtWidgets/qmenuadd_test.py
index cbe738e53..c7f2ff74f 100644
--- a/sources/pyside6/tests/QtWidgets/qmenuadd_test.py
+++ b/sources/pyside6/tests/QtWidgets/qmenuadd_test.py
@@ -55,5 +55,6 @@ class QMenuAddAction(UsesQApplication):
addNewAction.trigger()
self.assertEqual(self.arg, ())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qobject_mi_test.py b/sources/pyside6/tests/QtWidgets/qobject_mi_test.py
index 6251f757c..169ee5279 100644
--- a/sources/pyside6/tests/QtWidgets/qobject_mi_test.py
+++ b/sources/pyside6/tests/QtWidgets/qobject_mi_test.py
@@ -59,15 +59,15 @@ class DoubleQObjectInheritanceTest(UsesQApplication):
obj = WidgetValidator()
- #QObject methods
+ # QObject methods
obj.setObjectName('aaaa')
self.assertEqual(obj.objectName(), 'aaaa')
- #QWidget methods
+ # QWidget methods
obj.setVisible(False)
self.assertFalse(obj.isVisible())
- #QIntValidator methods
+ # QIntValidator methods
state, string, number = obj.validate('aaaa', 0)
self.assertEqual(state, QValidator.Invalid)
state, string, number = obj.validate('33', 0)
diff --git a/sources/pyside6/tests/QtWidgets/qpen_test.py b/sources/pyside6/tests/QtWidgets/qpen_test.py
index c833ebd92..2707fc931 100644
--- a/sources/pyside6/tests/QtWidgets/qpen_test.py
+++ b/sources/pyside6/tests/QtWidgets/qpen_test.py
@@ -41,6 +41,7 @@ from PySide6.QtCore import Qt, QTimer
from PySide6.QtGui import QPen, QPainter
from PySide6.QtWidgets import QWidget
+
class Painting(QWidget):
def __init__(self):
super().__init__()
diff --git a/sources/pyside6/tests/QtWidgets/qpicture_test.py b/sources/pyside6/tests/QtWidgets/qpicture_test.py
index c8f485142..06364e4be 100644
--- a/sources/pyside6/tests/QtWidgets/qpicture_test.py
+++ b/sources/pyside6/tests/QtWidgets/qpicture_test.py
@@ -40,18 +40,20 @@ from PySide6.QtCore import QTimer
from PySide6.QtGui import QPicture, QPainter
from PySide6.QtWidgets import QWidget
+
class MyWidget(QWidget):
def paintEvent(self, e):
p = QPainter(self)
p.drawPicture(0, 0, self._picture)
self._app.quit()
+
class QPictureTest(UsesQApplication):
def testFromData(self):
picture = QPicture()
painter = QPainter()
painter.begin(picture)
- painter.drawEllipse(10,20, 80,70)
+ painter.drawEllipse(10, 20, 80, 70)
painter.end()
data = picture.data()
@@ -67,6 +69,7 @@ class QPictureTest(UsesQApplication):
QTimer.singleShot(300, w.show)
self.app.exec_()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qpixmap_constructor.py b/sources/pyside6/tests/QtWidgets/qpixmap_constructor.py
index 10d873abe..81afc3792 100644
--- a/sources/pyside6/tests/QtWidgets/qpixmap_constructor.py
+++ b/sources/pyside6/tests/QtWidgets/qpixmap_constructor.py
@@ -274,6 +274,7 @@ xpm = [
". ( A ~+{+]+^+l > /+D f.c q . + . . + + . + + + + + + "
]
+
class QStringSequenceTest(UsesQApplication):
def testQPixmapConstructor(self):
label = QLabel()
@@ -282,5 +283,6 @@ class QStringSequenceTest(UsesQApplication):
self.assertEqual(pixmap1.width(), 27)
self.assertEqual(pixmap1.height(), 22)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
index f126f58b6..78cfe75da 100644
--- a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
+++ b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
@@ -39,6 +39,7 @@ from helper.usesqapplication import UsesQApplication
from PySide6.QtWidgets import QPushButton, QMenu, QWidget
from PySide6.QtCore import QTimer
+
class MyWidget(QWidget):
def __init__(self):
super().__init__()
@@ -71,6 +72,7 @@ class QPushButtonTest(UsesQApplication):
b.toggle()
self.assertTrue(self._clicked)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qshortcut_test.py b/sources/pyside6/tests/QtWidgets/qshortcut_test.py
index 4fefcca64..392f9dff6 100644
--- a/sources/pyside6/tests/QtWidgets/qshortcut_test.py
+++ b/sources/pyside6/tests/QtWidgets/qshortcut_test.py
@@ -43,6 +43,7 @@ from PySide6.QtCore import Qt, QTimer
from PySide6.QtGui import QKeySequence, QShortcut
from PySide6.QtWidgets import QApplication, QWidget
+
class Foo(QWidget):
def __init__(self):
super().__init__()
@@ -55,6 +56,7 @@ class Foo(QWidget):
def slot_of_copy(self):
self.copy = True
+
class MyShortcut(QShortcut):
def __init__(self, keys, wdg, slot):
QShortcut.__init__(self, keys, wdg, slot)
@@ -62,6 +64,7 @@ class MyShortcut(QShortcut):
def emit_signal(self):
self.activated.emit()
+
class QAppPresence(unittest.TestCase):
def testQShortcut(self):
@@ -70,15 +73,16 @@ class QAppPresence(unittest.TestCase):
self.sc = MyShortcut(QKeySequence(Qt.Key_Return), f, f.slot_of_foo)
self.scstd = MyShortcut(QKeySequence.Copy, f, f.slot_of_copy)
- QTimer.singleShot(0, self.init);
+ QTimer.singleShot(0, self.init)
self.qapp.exec_()
self.assertEqual(f.ok, True)
self.assertEqual(f.copy, True)
def init(self):
- self.sc.emit_signal();
- self.scstd.emit_signal();
+ self.sc.emit_signal()
+ self.scstd.emit_signal()
self.qapp.quit()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qsplitter_test.py b/sources/pyside6/tests/QtWidgets/qsplitter_test.py
index 20d0209bb..cce68f2d7 100644
--- a/sources/pyside6/tests/QtWidgets/qsplitter_test.py
+++ b/sources/pyside6/tests/QtWidgets/qsplitter_test.py
@@ -39,6 +39,7 @@ from PySide6.QtWidgets import QSplitter
from helper.usesqapplication import UsesQApplication
+
class QSplitterTest(UsesQApplication):
def testGetRange(self):
@@ -47,6 +48,7 @@ class QSplitterTest(UsesQApplication):
self.assertTrue(isinstance(_min, int))
self.assertTrue(isinstance(_max, int))
+
if __name__ == "__main__":
- unittest.main()
+ unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py b/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py
index 2061f174d..ddc9d2245 100644
--- a/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py
+++ b/sources/pyside6/tests/QtWidgets/qstandarditemmodel_test.py
@@ -44,14 +44,14 @@ from helper.usesqapplication import UsesQApplication
class QStandardItemModelTest(UsesQApplication):
def setUp(self):
- super(QStandardItemModelTest, self).setUp()
- self.window = QWidget()
- self.model = QStandardItemModel(0, 3, self.window)
+ super(QStandardItemModelTest, self).setUp()
+ self.window = QWidget()
+ self.model = QStandardItemModel(0, 3, self.window)
def tearDown(self):
- del self.window
- del self.model
- super(QStandardItemModelTest, self).tearDown()
+ del self.window
+ del self.model
+ super(QStandardItemModelTest, self).tearDown()
def testInsertRow(self):
# bug #227
@@ -92,7 +92,7 @@ class QStandardItemModelRef(UsesQApplication):
# only rest 1 reference
self.assertEqual(sys.getrefcount(items[r][c]), 2)
- my_i = model.item(0,0)
+ my_i = model.item(0, 0)
# ref(my_i) + parent_ref + items list ref
self.assertEqual(sys.getrefcount(my_i), 4)
diff --git a/sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py b/sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py
index c8f6c2dbc..85ae7b65b 100644
--- a/sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py
+++ b/sources/pyside6/tests/QtWidgets/qstring_qkeysequence_test.py
@@ -63,6 +63,7 @@ class QStringQKeySequenceTest(UsesQApplication):
self.assertTrue(isinstance(shortcut, QKeySequence))
self.assertEqual(shortcut.toString(), keyseq)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qstyle_test.py b/sources/pyside6/tests/QtWidgets/qstyle_test.py
index 1b0208a62..6993e8b90 100644
--- a/sources/pyside6/tests/QtWidgets/qstyle_test.py
+++ b/sources/pyside6/tests/QtWidgets/qstyle_test.py
@@ -42,6 +42,7 @@ from PySide6.QtGui import QWindow
from PySide6.QtWidgets import (QApplication, QFontComboBox, QLabel, QProxyStyle,
QStyleFactory, QWidget)
+
class ProxyStyle(QProxyStyle):
def __init__(self, style):
@@ -84,7 +85,7 @@ class SetStyleTest(UsesQApplication):
label.setStyle(proxyStyle)
label.show()
while not label.windowHandle().isExposed():
- QApplication.instance().processEvents()
+ QApplication.instance().processEvents()
self.assertTrue(proxyStyle.polished > 0)
def testSetStyleOwnership(self):
diff --git a/sources/pyside6/tests/QtWidgets/qtableview_test.py b/sources/pyside6/tests/QtWidgets/qtableview_test.py
index a8b524527..8e457d781 100644
--- a/sources/pyside6/tests/QtWidgets/qtableview_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtableview_test.py
@@ -39,6 +39,7 @@ from PySide6.QtCore import QAbstractTableModel
from PySide6.QtWidgets import QTableWidget
from helper.usesqapplication import UsesQApplication
+
class QPenTest(UsesQApplication):
def testItemModel(self):
@@ -46,6 +47,7 @@ class QPenTest(UsesQApplication):
self.assertEqual(type(tv.model()), QAbstractTableModel)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtabwidget_test.py b/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
index a302dabfe..aeccf6118 100644
--- a/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtabwidget_test.py
@@ -43,6 +43,7 @@ def makeBug643(tab):
button = QPushButton('Foo')
tab.insertTab(0, button, 'Foo')
+
class RemoveTabMethod(TimedQApplication):
def setUp(self):
TimedQApplication.setUp(self)
@@ -52,7 +53,6 @@ class RemoveTabMethod(TimedQApplication):
del self.tab
TimedQApplication.tearDown(self)
-
def testRemoveTabPresence(self):
self.assertTrue(getattr(self.tab, 'removeTab'))
@@ -60,5 +60,6 @@ class RemoveTabMethod(TimedQApplication):
makeBug643(self.tab)
self.assertEqual(self.tab.count(), 1)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py b/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py
index ff87f2bc2..cc3282361 100644
--- a/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QMainWindow, QTabWidget, QTextEdit, QSplitter
from helper.usesqapplication import UsesQApplication
+
class TabWidgetClear(QMainWindow):
def __init__(self):
super().__init__()
@@ -55,6 +56,7 @@ class TabWidgetClear(QMainWindow):
self.tabWidget.clear()
self.getSplitter()
+
class TestTabWidgetClear(UsesQApplication):
def testClear(self):
@@ -66,5 +68,6 @@ class TestTabWidgetClear(UsesQApplication):
# This should never happened, PYSIDE-213
raise e
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py b/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py
index 964e187f9..534527cac 100644
--- a/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py
@@ -69,6 +69,7 @@ class testSignalWithCPPSlot(UsesQApplication):
w.start()
self.assertEqual(w.text(), "PySide")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtextedit_test.py b/sources/pyside6/tests/QtWidgets/qtextedit_test.py
index 241197f45..28f435f94 100644
--- a/sources/pyside6/tests/QtWidgets/qtextedit_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtextedit_test.py
@@ -42,6 +42,7 @@ from PySide6.QtWidgets import QTextEdit
from helper.usesqapplication import UsesQApplication
+
class DontTouchReference(UsesQApplication):
'''Check if the QTextTable returned by QTextCursor.insertTable() is not
referenced by the QTextCursor that returns it.'''
@@ -64,5 +65,6 @@ class DontTouchReference(UsesQApplication):
self.assertEqual(getrefcount(self.table), 2)
cell = self.table.cellAt(0, 0)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtoolbar_test.py b/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
index 3e5ae7194..3f86c3f98 100644
--- a/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtoolbar_test.py
@@ -42,29 +42,31 @@ from PySide6.QtWidgets import QToolBar, QMainWindow
from helper.usesqapplication import UsesQApplication
+
class AddActionText(UsesQApplication):
'''Test case for calling QToolbar.addAction passing a text'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(AddActionText, self).setUp()
self.window = QMainWindow()
self.toolbar = QToolBar()
self.window.addToolBar(self.toolbar)
def tearDown(self):
- #Release resources
+ # Release resources
super(AddActionText, self).tearDown()
del self.toolbar
del self.window
def testText(self):
- #QToolBar.addAction(text) - add a QToolButton
+ # QToolBar.addAction(text) - add a QToolButton
self.toolbar.addAction('aaaa')
self.assertEqual(len(self.toolbar.actions()), 1)
action = self.toolbar.actions()[0]
self.assertTrue(isinstance(action, QAction))
self.assertEqual(action.text(), 'aaaa')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtoolbox_test.py b/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
index e9b69821a..79c447fd7 100644
--- a/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtoolbox_test.py
@@ -40,6 +40,7 @@ from PySide6.QtWidgets import QToolBox, QWidget
from helper.usesqapplication import UsesQApplication
+
class OwnershipControl(UsesQApplication):
def setUp(self):
diff --git a/sources/pyside6/tests/QtWidgets/qtreeview_test.py b/sources/pyside6/tests/QtWidgets/qtreeview_test.py
index cbaed8c83..fbbbd6cef 100644
--- a/sources/pyside6/tests/QtWidgets/qtreeview_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtreeview_test.py
@@ -41,6 +41,7 @@ from PySide6.QtWidgets import (QWidget, QTreeView, QVBoxLayout,
from PySide6.QtCore import Qt
from helper.usesqapplication import UsesQApplication
+
class Widget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
@@ -52,6 +53,7 @@ class Widget(QWidget):
self.treeView.model().setHorizontalHeaderLabels(('3', '1', '5'))
+
class QWidgetTest(UsesQApplication):
def testDelegates(self):
@@ -99,5 +101,6 @@ class QWidgetTest(UsesQApplication):
tree.setHeader(QHeaderView(Qt.Horizontal))
self.assertIsNotNone(tree.header())
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qtreewidget_test.py b/sources/pyside6/tests/QtWidgets/qtreewidget_test.py
index dbbad1c6d..2ed85b5c5 100644
--- a/sources/pyside6/tests/QtWidgets/qtreewidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qtreewidget_test.py
@@ -38,6 +38,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QTreeWidget, QTreeWidgetItem, QPushButton
from helper.usesqapplication import UsesQApplication
+
class QTreeWidgetTest(UsesQApplication):
# PYSIDE-73:
@@ -58,14 +59,15 @@ class QTreeWidgetTest(UsesQApplication):
QPushButton('Push button on column 1'))
# Getting the widget back
- w = treeWidget.itemWidget(treeWidget.itemAt(0,1), 1)
+ w = treeWidget.itemWidget(treeWidget.itemAt(0, 1), 1)
self.assertIsInstance(w, QPushButton)
p = QPushButton('New independent button')
# Adding QPushButton object from variable
treeWidget.setItemWidget(item, 0, p)
- w = treeWidget.itemWidget(treeWidget.itemAt(0,0), 0)
+ w = treeWidget.itemWidget(treeWidget.itemAt(0, 0), 0)
self.assertIsInstance(w, QPushButton)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qvariant_test.py b/sources/pyside6/tests/QtWidgets/qvariant_test.py
index 49091502f..2907fb966 100644
--- a/sources/pyside6/tests/QtWidgets/qvariant_test.py
+++ b/sources/pyside6/tests/QtWidgets/qvariant_test.py
@@ -40,12 +40,15 @@ from PySide6.QtWidgets import (QApplication, QComboBox, QGraphicsScene,
from helper.usesqapplication import UsesQApplication
+
class MyDiagram(QGraphicsScene):
pass
+
class MyItem(QGraphicsRectItem):
def itemChange(self, change, value):
- return value;
+ return value
+
class Sequence(object):
# Having the __getitem__ method on a class transform the Python
@@ -57,6 +60,7 @@ class Sequence(object):
def __getitem__(self, key):
raise IndexError()
+
class QGraphicsSceneOnQVariantTest(UsesQApplication):
"""Test storage ot QGraphicsScene into QVariants"""
def setUp(self):
@@ -80,5 +84,6 @@ class QGraphicsSceneOnQVariantTest(UsesQApplication):
self.combo.addItem("test", userData=Sequence())
self.assertTrue(isinstance(self.combo.itemData(0), Sequence))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py b/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py
index 807965e20..02ab052ee 100644
--- a/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py
+++ b/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication, QHBoxLayout
from helper.usesqapplication import UsesQApplication
+
class QWidgetTest(UsesQApplication):
def test_setLayout(self):
@@ -63,6 +64,7 @@ class QWidgetTest(UsesQApplication):
widget = QWidget()
widget.setLayout(layout)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/qwidget_test.py b/sources/pyside6/tests/QtWidgets/qwidget_test.py
index 5b8bdd5a0..4a90648f6 100644
--- a/sources/pyside6/tests/QtWidgets/qwidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qwidget_test.py
@@ -39,10 +39,12 @@ init_test_paths(False)
from PySide6.QtWidgets import QWidget, QMainWindow
from helper.usesqapplication import UsesQApplication
+
class QWidgetInherit(QMainWindow):
def __init__(self):
QWidget.__init__(self) # Intended: Initialize QWidget instead of base
+
class NativeEventTestWidget(QWidget):
nativeEventCount = 0
@@ -54,11 +56,13 @@ class NativeEventTestWidget(QWidget):
self.nativeEventCount = self.nativeEventCount + 1
return [False, 0]
+
class QWidgetTest(UsesQApplication):
def testInheritance(self):
self.assertRaises(TypeError, QWidgetInherit)
+
class QWidgetVisible(UsesQApplication):
def testBasic(self):
@@ -77,5 +81,6 @@ class QWidgetVisible(UsesQApplication):
self.app.processEvents()
self.assertTrue(widget.nativeEventCount > 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/reference_count_test.py b/sources/pyside6/tests/QtWidgets/reference_count_test.py
index 8ca382561..00ebab4c3 100644
--- a/sources/pyside6/tests/QtWidgets/reference_count_test.py
+++ b/sources/pyside6/tests/QtWidgets/reference_count_test.py
@@ -48,14 +48,17 @@ from helper.usesqapplication import UsesQApplication
destroyedRect = False
destroyedPol = False
+
def rect_del(o):
global destroyedRect
destroyedRect = True
+
def pol_del(o):
global destroyedPol
destroyedPol = True
+
class ReferenceCount(UsesQApplication):
def setUp(self):
@@ -71,7 +74,7 @@ class ReferenceCount(UsesQApplication):
self.assertTrue(isinstance(pol, QGraphicsPolygonItem))
self.wrp = weakref.ref(pol, pol_del)
- #refcount need be 3 because one ref for QGraphicsScene, and one to rect obj
+ # refcount need be 3 because one ref for QGraphicsScene, and one to rect obj
self.assertEqual(sys.getrefcount(pol), 3)
def testReferenceCount(self):
@@ -85,19 +88,20 @@ class ReferenceCount(UsesQApplication):
self.wrr = weakref.ref(rect, rect_del)
- #refcount need be 3 because one ref for QGraphicsScene, and one to rect obj
+ # refcount need be 3 because one ref for QGraphicsScene, and one to rect obj
self.assertEqual(sys.getrefcount(rect), 3)
del rect
- #not destroyed because one ref continue in QGraphicsScene
+ # not destroyed because one ref continue in QGraphicsScene
self.assertEqual(destroyedRect, False)
self.assertEqual(destroyedPol, False)
del self.scene
- #QGraphicsScene was destroyed and this destroy internal ref to rect
+ # QGraphicsScene was destroyed and this destroy internal ref to rect
self.assertEqual(destroyedRect, True)
self.assertEqual(destroyedPol, True)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/signature_test.py b/sources/pyside6/tests/QtWidgets/signature_test.py
index c18048b8e..94224c6ae 100644
--- a/sources/pyside6/tests/QtWidgets/signature_test.py
+++ b/sources/pyside6/tests/QtWidgets/signature_test.py
@@ -89,5 +89,6 @@ class PySideSignatureTest(unittest.TestCase):
called_default = sig.parameters["exclude"].default()
self.assertEqual(type(called_default), PySide6.QtCore.QByteArray)
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/standardpixmap_test.py b/sources/pyside6/tests/QtWidgets/standardpixmap_test.py
index 900d5fb75..c6e696807 100644
--- a/sources/pyside6/tests/QtWidgets/standardpixmap_test.py
+++ b/sources/pyside6/tests/QtWidgets/standardpixmap_test.py
@@ -40,11 +40,13 @@ from PySide6.QtWidgets import QStyle
from helper.usesqapplication import UsesQApplication
+
class StandardPixmapTest(UsesQApplication):
- def testDefaultOptions(self): # Bug 253
+ def testDefaultOptions(self): # Bug 253
pixmap = self.app.style().standardPixmap(QStyle.SP_DirClosedIcon)
self.assertTrue(isinstance(pixmap, QPixmap))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/QtWidgets/test_module_template.py b/sources/pyside6/tests/QtWidgets/test_module_template.py
index 0f080fe99..83c1fce4b 100644
--- a/sources/pyside6/tests/QtWidgets/test_module_template.py
+++ b/sources/pyside6/tests/QtWidgets/test_module_template.py
@@ -38,12 +38,15 @@ init_test_paths()
from PySide6.QtWidgets import QWidget
from PySide6.QtCore import QObject
+
class MyQObject(QObject):
pass
+
class MyQWidget(QWidget):
pass
+
class Sentinel():
value = 10
diff --git a/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py b/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
index 5fd685f01..afe09f0c1 100644
--- a/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
+++ b/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py
@@ -42,11 +42,12 @@ from PySide6.QtWidgets import QApplication, QSpinBox
from helper.usesqapplication import UsesQApplication
+
class MySpinButton(QSpinBox):
'''Simple example class of overriding QObject.timerEvent'''
def __init__(self, max_runs=5, app=None):
- #Creates a new spinbox that will run <max_runs> and quit <app>
+ # Creates a new spinbox that will run <max_runs> and quit <app>
super().__init__()
if app is None:
@@ -57,7 +58,7 @@ class MySpinButton(QSpinBox):
self.runs = 0
def timerEvent(self, event):
- #Timer event method
+ # Timer event method
self.runs += 1
self.setValue(self.runs)
@@ -68,23 +69,24 @@ class MySpinButton(QSpinBox):
if not isinstance(event, QTimerEvent):
raise TypeError('Invalid event type. Must be TimerEvent')
+
class TimerEventTest(UsesQApplication):
'''Test case for running QObject.timerEvent from inherited class'''
qapplication = True
def setUp(self):
- #Acquire resources
+ # Acquire resources
super(TimerEventTest, self).setUp()
self.widget = MySpinButton(app=self.app)
def tearDown(self):
- #Release resources
+ # Release resources
del self.widget
super(TimerEventTest, self).tearDown()
def testMethod(self):
- #QWidget.timerEvent overrinding (protected inherited)
+ # QWidget.timerEvent overrinding (protected inherited)
timer_id = self.widget.startTimer(0)
self.app.exec_()
diff --git a/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py b/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py
index f6c29425b..8629af5b7 100644
--- a/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py
+++ b/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py
@@ -44,6 +44,7 @@ from helper.usesqapplication import UsesQApplication
qgraphics_item_painted = False
+
class RoundRectItem(QGraphicsRectItem):
def __init__(self, x, y, w, h):
diff --git a/sources/pyside6/tests/QtWidgets/wrong_return_test.py b/sources/pyside6/tests/QtWidgets/wrong_return_test.py
index 134acef14..f9267f3fa 100644
--- a/sources/pyside6/tests/QtWidgets/wrong_return_test.py
+++ b/sources/pyside6/tests/QtWidgets/wrong_return_test.py
@@ -52,6 +52,7 @@ class MyWidget(QWidget):
def sizeHint(self):
pass
+
class testCase(UsesQApplication):
def testVirtualReturn(self):
diff --git a/sources/pyside6/tests/QtXml/qdomdocument_test.py b/sources/pyside6/tests/QtXml/qdomdocument_test.py
index 5ce902438..a02062496 100644
--- a/sources/pyside6/tests/QtXml/qdomdocument_test.py
+++ b/sources/pyside6/tests/QtXml/qdomdocument_test.py
@@ -100,6 +100,7 @@ class QDomDocumentTest(unittest.TestCase):
child = child.nextSiblingElement('value-type')
checkAttribute(child, 'name', 'QDomElement')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/mac/qmacstyle_test.py b/sources/pyside6/tests/mac/qmacstyle_test.py
index 9b745cb1b..ab430c343 100644
--- a/sources/pyside6/tests/mac/qmacstyle_test.py
+++ b/sources/pyside6/tests/mac/qmacstyle_test.py
@@ -42,6 +42,7 @@ from PySide6.QtCore import QObject
from helper.usesqapplication import UsesQApplication
+
class QMacStyleTest(UsesQApplication):
def setUp(self):
UsesQApplication.setUp(self)
@@ -51,5 +52,6 @@ class QMacStyleTest(UsesQApplication):
w = QLabel('Hello')
self.assertTrue(isinstance(w.style(), self.QMacStyle))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/manually/bug_841.py b/sources/pyside6/tests/manually/bug_841.py
index 44edac83c..c3cf10c8b 100644
--- a/sources/pyside6/tests/manually/bug_841.py
+++ b/sources/pyside6/tests/manually/bug_841.py
@@ -31,6 +31,7 @@ import sys
from PySide6.QtGui import QStandardItem, QStandardItemModel
from PySide6.QtWidgets import QMainWindow, QTreeView, QAbstractItemView, QApplication, QMessageBox
+
class Item(QStandardItem):
def __init__(self, text):
super().__init__()
@@ -42,6 +43,7 @@ class Item(QStandardItem):
ret = Item(self.text())
return ret
+
class Project(QStandardItemModel):
def __init__(self):
super().__init__()
@@ -51,6 +53,7 @@ class Project(QStandardItemModel):
self.appendRow(Item("DEF"))
self.appendRow(Item("GHI"))
+
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
@@ -66,6 +69,7 @@ class MainWindow(QMainWindow):
print(e.x(), e.y())
return QMainWindow.mousePressEvent(self, e)
+
def main():
app = QApplication(sys.argv)
w = MainWindow()
@@ -73,5 +77,6 @@ def main():
QMessageBox.information(None, "Info", "Just drag and drop the items.")
sys.exit(app.exec_())
+
if __name__ == "__main__":
main()
diff --git a/sources/pyside6/tests/pysidetest/all_modules_load_test.py b/sources/pyside6/tests/pysidetest/all_modules_load_test.py
index 70da51eb7..f8f2d4b79 100644
--- a/sources/pyside6/tests/pysidetest/all_modules_load_test.py
+++ b/sources/pyside6/tests/pysidetest/all_modules_load_test.py
@@ -42,11 +42,13 @@ import PySide6
# It is also really not recommended to use. But for testing,
# the "__all__" variable is a great feature!
+
class AllModulesImportTest(unittest.TestCase):
def testAllModulesCanImport(self):
# would also work: exec("from PySide6 import *")
for name in PySide6.__all__:
exec(f"import PySide6.{name}")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/bug_1016.py b/sources/pyside6/tests/pysidetest/bug_1016.py
index 54a155fea..db57302a2 100644
--- a/sources/pyside6/tests/pysidetest/bug_1016.py
+++ b/sources/pyside6/tests/pysidetest/bug_1016.py
@@ -46,5 +46,6 @@ class TestBug1016 (unittest.TestCase):
self.assertEqual(obj.callMe(), None)
self.assertTrue(obj.wasCalled())
+
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/decoratedslot_test.py b/sources/pyside6/tests/pysidetest/decoratedslot_test.py
index d1f8f6d40..6db8cafc3 100644
--- a/sources/pyside6/tests/pysidetest/decoratedslot_test.py
+++ b/sources/pyside6/tests/pysidetest/decoratedslot_test.py
@@ -40,6 +40,7 @@ init_test_paths(True)
from PySide6.QtCore import QObject
from testbinding import TestObject
+
class Receiver(QObject):
def __init__(self):
super().__init__()
diff --git a/sources/pyside6/tests/pysidetest/delegatecreateseditor_test.py b/sources/pyside6/tests/pysidetest/delegatecreateseditor_test.py
index acbf5828e..9d1c5bf2b 100644
--- a/sources/pyside6/tests/pysidetest/delegatecreateseditor_test.py
+++ b/sources/pyside6/tests/pysidetest/delegatecreateseditor_test.py
@@ -47,6 +47,7 @@ from PySide6.QtWidgets import (QAbstractItemDelegate, QComboBox,
id_text = 'This is me'
+
class DelegateDoesntKeepReferenceToEditor(QAbstractItemDelegate):
def createEditor(self, parent, option, index):
comboBox = QComboBox(parent)
diff --git a/sources/pyside6/tests/pysidetest/embedding_test.py b/sources/pyside6/tests/pysidetest/embedding_test.py
index e4b5cb9f6..682b4c0b7 100644
--- a/sources/pyside6/tests/pysidetest/embedding_test.py
+++ b/sources/pyside6/tests/pysidetest/embedding_test.py
@@ -77,5 +77,6 @@ class EmbeddingTest(unittest.TestCase):
name = os.path.basename(dn(dn(dn(PySide6.support.signature.__file__))))
self.assertTrue(name.startswith("embedded.") and name.endswith(".zip"))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/enum_test.py b/sources/pyside6/tests/pysidetest/enum_test.py
index 6dbd2fb47..61febb299 100644
--- a/sources/pyside6/tests/pysidetest/enum_test.py
+++ b/sources/pyside6/tests/pysidetest/enum_test.py
@@ -39,6 +39,7 @@ init_test_paths(True)
from testbinding import Enum1, TestObjectWithoutNamespace
+
class ListConnectionTest(unittest.TestCase):
def testEnumVisibility(self):
@@ -47,6 +48,7 @@ class ListConnectionTest(unittest.TestCase):
self.assertEqual(TestObjectWithoutNamespace.Enum2.Option3, 3)
self.assertEqual(TestObjectWithoutNamespace.Enum2.Option4, 4)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py b/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py
index 0ca946541..b29d37fc2 100644
--- a/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py
+++ b/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py
@@ -41,6 +41,7 @@ from testbinding import TestObject
'''Tests the behaviour of homonymous signals and slots.'''
+
class HomonymousSignalAndMethodTest(unittest.TestCase):
def setUp(self):
@@ -84,6 +85,7 @@ class HomonymousSignalAndMethodTest(unittest.TestCase):
def testHomonymousSignalAndStaticMethodFromInstance(self):
self.assertEqual(self.obj.staticMethodDouble(4), 8)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/iterable_test.py b/sources/pyside6/tests/pysidetest/iterable_test.py
index e8a85acf8..d2bf8c9f2 100644
--- a/sources/pyside6/tests/pysidetest/iterable_test.py
+++ b/sources/pyside6/tests/pysidetest/iterable_test.py
@@ -50,6 +50,7 @@ try:
except ImportError:
have_numpy = False
+
class PySequenceTest(unittest.TestCase):
def test_iterable(self):
diff --git a/sources/pyside6/tests/pysidetest/list_signal_test.py b/sources/pyside6/tests/pysidetest/list_signal_test.py
index 58e849df9..93b8514d7 100644
--- a/sources/pyside6/tests/pysidetest/list_signal_test.py
+++ b/sources/pyside6/tests/pysidetest/list_signal_test.py
@@ -40,6 +40,7 @@ init_test_paths(True)
from testbinding import TestObject
from PySide6.QtCore import QObject
+
class ListConnectionTest(unittest.TestCase):
def childrenChanged(self, children):
@@ -54,6 +55,7 @@ class ListConnectionTest(unittest.TestCase):
o.addChild(c)
self.assertEqual(self._child.objectName(), "child")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py b/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py
index adf8b8045..19b9a583e 100644
--- a/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py
+++ b/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py
@@ -47,9 +47,11 @@ from PySide6.QtCore import QObject, Signal, Slot
class Mixin(object):
mixinSignal = Signal()
+
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
+
class MixinTwo(Mixin):
mixinTwoSignal = Signal()
@@ -61,6 +63,7 @@ class MixinTwo(Mixin):
def mixinTwoSlot(self):
self.mixinTwoSlotCalled = True
+
class MixinThree(object):
mixinThreeSignal = Signal()
@@ -72,6 +75,7 @@ class MixinThree(object):
def mixinThreeSlot(self):
self.mixinThreeSlotCalled = True
+
class Derived(Mixin, QObject):
derivedSignal = Signal(str)
@@ -85,6 +89,7 @@ class Derived(Mixin, QObject):
self.derivedSlotCalled = True
self.derivedSlotString = theString
+
class MultipleDerived(MixinTwo, MixinThree, Mixin, QObject):
derivedSignal = Signal(str)
@@ -121,6 +126,7 @@ class MixinTest(unittest.TestCase):
# Check derivedSignal emission after mixingSignal connection
self.outsideSlotCalled = False
+
@Slot()
def outsideSlot():
self.outsideSlotCalled = True
@@ -146,7 +152,6 @@ class MixinTest(unittest.TestCase):
signature = m.method(i).methodSignature()
self.assertEqual(methodIndices[signature], i)
-
def testMixinSignalSlotRegistrationWithMultipleInheritance(self):
obj = MultipleDerived()
m = obj.metaObject()
@@ -170,6 +175,7 @@ class MixinTest(unittest.TestCase):
# Check derivedSignal emission after mixinThreeSignal connection
self.outsideSlotCalled = False
+
@Slot()
def outsideSlot():
self.outsideSlotCalled = True
diff --git a/sources/pyside6/tests/pysidetest/modelview_test.py b/sources/pyside6/tests/pysidetest/modelview_test.py
index 1aa72d98a..3329b5875 100644
--- a/sources/pyside6/tests/pysidetest/modelview_test.py
+++ b/sources/pyside6/tests/pysidetest/modelview_test.py
@@ -44,9 +44,11 @@ from PySide6.QtCore import QAbstractListModel, QObject, QModelIndex
object_name = 'test object'
+
class MyObject(QObject):
pass
+
class ListModelKeepsReference(QAbstractListModel):
def __init__(self, parent=None):
QAbstractListModel.__init__(self, parent)
@@ -59,6 +61,7 @@ class ListModelKeepsReference(QAbstractListModel):
def data(self, index, role):
return self.obj
+
class ListModelDoesntKeepsReference(QAbstractListModel):
def rowCount(self, parent=QModelIndex()):
return 1
@@ -68,6 +71,7 @@ class ListModelDoesntKeepsReference(QAbstractListModel):
obj.setObjectName(object_name)
return obj
+
class ListModelThatReturnsString(QAbstractListModel):
def rowCount(self, parent=QModelIndex()):
return 1
@@ -101,6 +105,7 @@ class ModelViewTest(unittest.TestCase):
self.assertEqual(type(obj), str)
self.assertEqual(obj, 'string')
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/new_inherited_functions_test.py b/sources/pyside6/tests/pysidetest/new_inherited_functions_test.py
index a4e996f96..f4d83ad9f 100644
--- a/sources/pyside6/tests/pysidetest/new_inherited_functions_test.py
+++ b/sources/pyside6/tests/pysidetest/new_inherited_functions_test.py
@@ -182,16 +182,17 @@ class MainTest(unittest.TestCase):
except AttributeError:
unittest.TestCase().skipTest("this test makes only sense if QtWidgets is available.")
try:
- PySide6.QtWidgets.QApplication.palette(42) # raises
+ PySide6.QtWidgets.QApplication.palette(42) # raises
except TypeError as e:
lines = e.args[0].splitlines()
heading_pos = lines.index("Supported signatures:")
- lines = lines[heading_pos+1:]
+ lines = lines[heading_pos + 1:]
self.assertEqual(len(lines), 3)
txt = '\n'.join(lines)
print("Signatures found:")
print(txt)
self.assertTrue("palette()" in txt)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/notify_id.py b/sources/pyside6/tests/pysidetest/notify_id.py
index f3c38ab06..f11eacdda 100644
--- a/sources/pyside6/tests/pysidetest/notify_id.py
+++ b/sources/pyside6/tests/pysidetest/notify_id.py
@@ -40,6 +40,7 @@ from PySide6.QtCore import QObject, Signal, Property, Slot
'''Tests that the signal notify id of a property is correct, aka corresponds to the initially set
notify method.'''
+
class Foo(QObject):
def __init__(self):
super().__init__()
@@ -63,6 +64,7 @@ class Foo(QObject):
propChanged = Signal()
prop = Property(str, getProp, setProp, notify=propChanged)
+
class NotifyIdSignal(unittest.TestCase):
def setUp(self):
self.obj = Foo()
@@ -80,5 +82,6 @@ class NotifyIdSignal(unittest.TestCase):
signalName = signal.name()
self.assertEqual(signalName, "propChanged")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/property_python_test.py b/sources/pyside6/tests/pysidetest/property_python_test.py
index 6e19e92a0..baf4cdb01 100644
--- a/sources/pyside6/tests/pysidetest/property_python_test.py
+++ b/sources/pyside6/tests/pysidetest/property_python_test.py
@@ -49,7 +49,6 @@ from init_paths import init_test_paths
init_test_paths(False)
from PySide6.QtCore import Property, QObject
-#from PyQt5.QtCore import pyqtProperty as Property, QObject
# This are the original imports.
import sys
@@ -61,18 +60,23 @@ try:
except ImportError:
pass
+
class PropertyBase(Exception):
pass
+
class PropertyGet(PropertyBase):
pass
+
class PropertySet(PropertyBase):
pass
+
class PropertyDel(PropertyBase):
pass
+
class BaseClass(QObject):
def __init__(self):
super().__init__()
@@ -92,6 +96,7 @@ class BaseClass(QObject):
def spam(self):
del self._spam
+
class SubClass(BaseClass):
@BaseClass.spam.getter
@@ -107,24 +112,29 @@ class SubClass(BaseClass):
def spam(self):
raise PropertyDel(self._spam)
+
class PropertyDocBase(object):
_spam = 1
+
def _get_spam(self):
return self._spam
spam = Property(object, _get_spam, doc="spam spam spam")
+
class PropertyDocSub(PropertyDocBase):
@PropertyDocBase.spam.getter
def spam(self):
"""The decorator does not use this doc string"""
return self._spam
+
class PropertySubNewGetter(BaseClass):
@BaseClass.spam.getter
def spam(self):
"""new docstring"""
return 5
+
class PropertyNewGetter(QObject):
def __init__(self):
super().__init__()
@@ -133,11 +143,13 @@ class PropertyNewGetter(QObject):
def spam(self):
"""original docstring"""
return 1
+
@spam.getter
def spam(self):
"""new docstring"""
return 8
+
class PropertyTests(unittest.TestCase):
def test_property_decorator_baseclass(self):
# see #1620
diff --git a/sources/pyside6/tests/pysidetest/qapp_like_a_macro_test.py b/sources/pyside6/tests/pysidetest/qapp_like_a_macro_test.py
index 5acefefa1..c83d2a860 100644
--- a/sources/pyside6/tests/pysidetest/qapp_like_a_macro_test.py
+++ b/sources/pyside6/tests/pysidetest/qapp_like_a_macro_test.py
@@ -42,6 +42,7 @@ import PySide6
# Note: this test makes qapplication_singleton_test.py obsolete.
+
class qAppMacroTest(unittest.TestCase):
_test_1093_is_first = True
@@ -62,9 +63,11 @@ class qAppMacroTest(unittest.TestCase):
QtWidgets.QApplication)
fil = sys.stderr
for klass in classes:
- print("CREATED", klass([]), file=fil); fil.flush()
+ print("CREATED", klass([]), file=fil)
+ fil.flush()
qApp.shutdown()
- print("DELETED qApp", qApp, file=fil); fil.flush()
+ print("DELETED qApp", qApp, file=fil)
+ fil.flush()
# creating without deletion raises:
QtCore.QCoreApplication([])
with self.assertRaises(RuntimeError):
diff --git a/sources/pyside6/tests/pysidetest/qvariant_test.py b/sources/pyside6/tests/pysidetest/qvariant_test.py
index eadc2aad0..637aa95cf 100644
--- a/sources/pyside6/tests/pysidetest/qvariant_test.py
+++ b/sources/pyside6/tests/pysidetest/qvariant_test.py
@@ -41,6 +41,7 @@ from PySide6.QtGui import QKeySequence
from helper.usesqapplication import UsesQApplication
+
class QVariantTest(UsesQApplication):
def testQKeySequenceQVariantOperator(self):
@@ -48,5 +49,6 @@ class QVariantTest(UsesQApplication):
ks = QKeySequence(Qt.SHIFT, Qt.CTRL, Qt.Key_P, Qt.Key_R)
self.assertEqual(TestObject.checkType(ks), 4107)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/repr_test.py b/sources/pyside6/tests/pysidetest/repr_test.py
index 587caddcc..dd9f08ea4 100644
--- a/sources/pyside6/tests/pysidetest/repr_test.py
+++ b/sources/pyside6/tests/pysidetest/repr_test.py
@@ -51,6 +51,7 @@ init_test_paths(True)
from testbinding import PySideCPP, TestObject
+
class QObjectDerivedReprTest(unittest.TestCase):
"""Test the __repr__ implementation of QObject derived classes"""
@@ -86,6 +87,7 @@ class QObjectDerivedReprTest(unittest.TestCase):
# __repr__ should use the operator<<(QDebug,...) implementation
self.assertEqual(str(t), "TestObject2WithNamespace(injected_repr)")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/signal_slot_warning.py b/sources/pyside6/tests/pysidetest/signal_slot_warning.py
index 429fb113a..67dce8084 100644
--- a/sources/pyside6/tests/pysidetest/signal_slot_warning.py
+++ b/sources/pyside6/tests/pysidetest/signal_slot_warning.py
@@ -54,6 +54,7 @@ class Whatever(QtCore.QObject):
def mySlot(self, v):
pass
+
class WarningTest(unittest.TestCase):
def testSignalSlotWarning(self):
# we create an object. This gives no warning.
diff --git a/sources/pyside6/tests/pysidetest/signalandnamespace_test.py b/sources/pyside6/tests/pysidetest/signalandnamespace_test.py
index f78d05ed6..c84346928 100644
--- a/sources/pyside6/tests/pysidetest/signalandnamespace_test.py
+++ b/sources/pyside6/tests/pysidetest/signalandnamespace_test.py
@@ -39,6 +39,7 @@ init_test_paths(True)
from testbinding import PySideCPP, TestObjectWithoutNamespace
+
class ModelViewTest(unittest.TestCase):
def callback(self, o):
@@ -70,7 +71,6 @@ class ModelViewTest(unittest.TestCase):
o.callSignalWithNamespace(o)
self.assertTrue(o == self._called)
-
def testWithoutNamespace1(self):
self._called = None
o = TestObjectWithoutNamespace(None)
@@ -123,6 +123,7 @@ class ModelViewTest(unittest.TestCase):
o.callSignalWithTypedef(10)
self.assertEqual(10, self._called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py b/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py
index 4a3f8a178..8a3f64032 100644
--- a/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py
+++ b/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py
@@ -42,6 +42,7 @@ from PySide6.QtCore import QObject, SIGNAL
'''Tests the behaviour of signals with default values when emitted from Python.'''
+
class SignalEmissionFromPython(unittest.TestCase):
def setUp(self):
@@ -60,6 +61,7 @@ class SignalEmissionFromPython(unittest.TestCase):
def callbackOne():
self.one_called += 1
self.obj2.signalWithDefaultValue.emit()
+
def callbackTwo():
self.two_called += 1
self.obj1.signalWithDefaultValue.connect(callbackOne)
@@ -73,6 +75,7 @@ class SignalEmissionFromPython(unittest.TestCase):
def callbackOne():
self.one_called += 1
self.obj2.signalWithDefaultValue.emit()
+
def callbackTwo():
self.two_called += 1
QObject.connect(self.obj1, SIGNAL('signalWithDefaultValue()'), callbackOne)
@@ -86,6 +89,7 @@ class SignalEmissionFromPython(unittest.TestCase):
def callbackOne():
self.one_called += 1
self.obj2.signalWithDefaultValue[bool].emit(True)
+
def callbackTwo():
self.two_called += 1
self.obj1.signalWithDefaultValue.connect(callbackOne)
@@ -99,6 +103,7 @@ class SignalEmissionFromPython(unittest.TestCase):
def callbackOne():
self.one_called += 1
self.obj2.signalWithDefaultValue[bool].emit(True)
+
def callbackTwo():
self.two_called += 1
QObject.connect(self.obj1, SIGNAL('signalWithDefaultValue()'), callbackOne)
@@ -109,7 +114,6 @@ class SignalEmissionFromPython(unittest.TestCase):
self.assertEqual(self.two_called, 2)
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py b/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py
index 1e715da38..c44cca396 100644
--- a/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py
+++ b/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py
@@ -42,6 +42,7 @@ from PySide6.QtCore import QObject, SIGNAL
'''Tests the behaviour of signals with default values.'''
+
class SignalWithDefaultValueTest(unittest.TestCase):
def setUp(self):
@@ -57,6 +58,7 @@ class SignalWithDefaultValueTest(unittest.TestCase):
def testConnectNewStyleEmitVoidSignal(self):
def callbackVoid():
self.void_called = True
+
def callbackBool(value):
self.bool_called = True
self.obj.signalWithDefaultValue.connect(callbackVoid)
@@ -68,6 +70,7 @@ class SignalWithDefaultValueTest(unittest.TestCase):
def testConnectNewStyleEmitBoolSignal(self):
def callbackVoid():
self.void_called = True
+
def callbackBool(value):
self.bool_called = True
self.obj.signalWithDefaultValue.connect(callbackVoid)
@@ -79,6 +82,7 @@ class SignalWithDefaultValueTest(unittest.TestCase):
def testConnectOldStyleEmitVoidSignal(self):
def callbackVoid():
self.void_called = True
+
def callbackBool(value):
self.bool_called = True
QObject.connect(self.obj, SIGNAL('signalWithDefaultValue()'), callbackVoid)
@@ -90,6 +94,7 @@ class SignalWithDefaultValueTest(unittest.TestCase):
def testConnectOldStyleEmitBoolSignal(self):
def callbackVoid():
self.void_called = True
+
def callbackBool(value):
self.bool_called = True
QObject.connect(self.obj, SIGNAL('signalWithDefaultValue()'), callbackVoid)
@@ -98,6 +103,7 @@ class SignalWithDefaultValueTest(unittest.TestCase):
self.assertTrue(self.void_called)
self.assertTrue(self.bool_called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/typedef_signal_test.py b/sources/pyside6/tests/pysidetest/typedef_signal_test.py
index 8bab3eab5..714695823 100644
--- a/sources/pyside6/tests/pysidetest/typedef_signal_test.py
+++ b/sources/pyside6/tests/pysidetest/typedef_signal_test.py
@@ -38,6 +38,7 @@ init_test_paths(True)
from PySide6.QtCore import QObject
from testbinding import TestObject
+
class Receiver(QObject):
def __init__(self):
@@ -47,6 +48,7 @@ class Receiver(QObject):
def slot(self, value):
self.received = value
+
class TypedefSignal(unittest.TestCase):
def testTypedef(self):
@@ -57,5 +59,6 @@ class TypedefSignal(unittest.TestCase):
obj.emitSignalWithTypedefValue(2)
self.assertEqual(receiver.received.value, 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/pysidetest/version_test.py b/sources/pyside6/tests/pysidetest/version_test.py
index aba4da9c0..397e61a68 100644
--- a/sources/pyside6/tests/pysidetest/version_test.py
+++ b/sources/pyside6/tests/pysidetest/version_test.py
@@ -51,6 +51,7 @@ class CheckForVariablesTest(unittest.TestCase):
self.assertTrue(__version_info__ >= (4, 5, 0))
self.assertTrue(__version__)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/registry/existence_test.py b/sources/pyside6/tests/registry/existence_test.py
index a6121381d..2ab18152a 100644
--- a/sources/pyside6/tests/registry/existence_test.py
+++ b/sources/pyside6/tests/registry/existence_test.py
@@ -140,7 +140,7 @@ class TestSignaturesExists(unittest.TestCase):
for key, value in sig_exists.sig_dict.items():
name = key.rsplit(".", 1)[-1]
- if name in ("next", "__next__"): # ignore problematic cases
+ if name in ("next", "__next__"): # ignore problematic cases
continue
if "<" in key:
# Skip over remaining crap in "<...>"
diff --git a/sources/pyside6/tests/registry/init_platform.py b/sources/pyside6/tests/registry/init_platform.py
index bab75272b..41b49dd53 100644
--- a/sources/pyside6/tests/registry/init_platform.py
+++ b/sources/pyside6/tests/registry/init_platform.py
@@ -56,6 +56,7 @@ from contextlib import contextmanager
from textwrap import dedent
from util import get_refpath, get_script_dir
+
def qt_build():
result = '<Unknown build of Qt>'
try:
@@ -65,6 +66,7 @@ def qt_build():
pass
return result
+
script_dir = get_script_dir()
history_dir = os.path.join(script_dir, 'build_history')
@@ -105,6 +107,8 @@ pyside_build_dir = os.path.join(all_build_dir, "pyside6")
shiboken_build_dir = os.path.join(all_build_dir, "shiboken6")
# now we compute all paths:
+
+
def set_ospaths(build_dir):
ps = os.pathsep
ospath_var = "PATH" if sys.platform == "win32" else "LD_LIBRARY_PATH"
@@ -119,6 +123,7 @@ def set_ospaths(build_dir):
ospath = ps.join(lib_path + old_val.split(ps))
os.environ[ospath_var] = ospath
+
set_ospaths(all_build_dir)
import PySide6
diff --git a/sources/pyside6/tests/registry/scrape_testresults.py b/sources/pyside6/tests/registry/scrape_testresults.py
index 07e44199d..ce02e8e52 100644
--- a/sources/pyside6/tests/registry/scrape_testresults.py
+++ b/sources/pyside6/tests/registry/scrape_testresults.py
@@ -85,6 +85,7 @@ cache_path = os.path.dirname(test_path)
target_path = os.path.dirname(__file__)
start_time = time.time()
+
def get_name(url):
"""
Return the last piece of an url, including trailing slash.
@@ -96,14 +97,17 @@ def get_name(url):
name += "/"
return name
+
def rel_url(url):
"""
throw the top URL away
"""
return url[len(top_url):]
+
stop_all = False
+
def find_all_links(text, url, ignore=()):
"""
Find all links in a page.
@@ -126,6 +130,7 @@ def find_all_links(text, url, ignore=()):
urls = list(url + name for name in names)
return urls
+
def read_url(url):
# We intentionally let things fail, because we re-run things on failure.
try:
@@ -141,6 +146,7 @@ def read_url(url):
else:
return response
+
def get_timestamp(text):
# agent:2018/06/29 15:02:15
global stop_all
@@ -164,6 +170,7 @@ def get_timestamp(text):
raise
return ts
+
def write_data(name, text):
try:
ts = get_timestamp(text)
@@ -195,6 +202,7 @@ def write_data(name, text):
with open(fn, "w") as f:
f.write(text)
+
def eval_data(force=False):
"""
Read all found files, sort them and keep the latest version.
@@ -220,9 +228,10 @@ def eval_data(force=False):
print("+++ generated:", name)
return len(results)
+
def handle_suburl(idx, n, url, level):
if level == 1:
- print(os.getpid(), "Reading", idx+1, "of", n, rel_url(url))
+ print(os.getpid(), "Reading", idx + 1, "of", n, rel_url(url))
response = read_url(url)
urls = find_all_links(response.text, url)
for sub_url in urls:
@@ -249,7 +258,7 @@ def handle_suburl(idx, n, url, level):
def handle_suburl_tup(idx_n_url_level):
if stop_all:
- return # bad solution, but it stops fast
+ return # bad solution, but it stops fast
idx, n, url, level = idx_n_url_level
try:
ret = handle_suburl(idx, n, url, level)
@@ -257,6 +266,7 @@ def handle_suburl_tup(idx_n_url_level):
except requests.exceptions.RequestException as e:
return url, e
+
def handle_batch(urls, level):
n = len(urls)
args = ((idx, n, url, level) for (idx, url) in enumerate(urls))
@@ -279,6 +289,7 @@ def handle_batch(urls, level):
print("Runs:", ", ".join(map(str, runs)))
return not urls
+
def handle_topurl(url):
"""
Find all links to directories.
@@ -313,6 +324,7 @@ def handle_topurl(url):
json.dump(urls, fp, sort_keys=True, indent=4)
return success
+
def get_test_results(starturl):
ok = handle_topurl(starturl)
stop_time = time.time()
@@ -328,6 +340,7 @@ def get_test_results(starturl):
if found:
print("Please check if a git push is necessary.")
+
if __name__ == "__main__":
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
diff --git a/sources/pyside6/tests/registry/util.py b/sources/pyside6/tests/registry/util.py
index dba4b5c0a..4a4b2fd01 100644
--- a/sources/pyside6/tests/registry/util.py
+++ b/sources/pyside6/tests/registry/util.py
@@ -54,6 +54,7 @@ from contextlib import contextmanager
warn_name = "__warningregistry__"
ignore_re = 'Not importing directory .*'
+
@contextmanager
def isolate_warnings():
save_warnings = {}
@@ -71,12 +72,14 @@ def isolate_warnings():
if warn is None:
delattr(mod, warn_name)
+
@contextmanager
def suppress_warnings():
with warnings.catch_warnings():
warnings.simplefilter("ignore")
yield
+
def check_warnings():
for name, mod in sys.modules.items():
if mod:
@@ -90,6 +93,7 @@ def check_warnings():
return True
return False
+
def warn(message, category=None, stacklevel=2):
"""Issue a warning with the default 'RuntimeWarning'"""
if category is None:
@@ -135,28 +139,36 @@ else:
is_py3 = sys.version_info[0] == 3
is_ci = os.environ.get("QTEST_ENVIRONMENT", "") == "ci"
+
def get_script_dir():
script_dir = os.path.normpath(os.path.dirname(__file__))
while "sources" not in os.listdir(script_dir):
script_dir = os.path.dirname(script_dir)
return script_dir
+
def qt_version():
from PySide6.QtCore import __version__
return tuple(map(int, __version__.split(".")))
# Format a registry file name for version.
+
+
def _registry_filename(version, use_ci_module):
ext_ci = "_ci" if use_ci_module else ""
name = f"exists_{platform_name}_{version[0]}_{version[1]}_{version[2]}{ext_ci}.py"
return os.path.join(os.path.dirname(__file__), name)
# Return the expected registry file name.
+
+
def get_refpath(use_ci_module=is_ci):
return _registry_filename(qt_version(), use_ci_module)
# Return the registry file name, either that of the current
# version or fall back to a previous patch release.
+
+
def get_effective_refpath(use_ci_module=is_ci):
refpath = get_refpath(use_ci_module)
if os.path.exists(refpath):
@@ -171,6 +183,8 @@ def get_effective_refpath(use_ci_module=is_ci):
return refpath
# Import the CI version of the platform module
+
+
def import_refmodule(use_ci_module=is_ci):
refpath = get_effective_refpath(use_ci_module)
modname = os.path.basename(os.path.splitext(refpath)[0])
diff --git a/sources/pyside6/tests/signals/args_dont_match_test.py b/sources/pyside6/tests/signals/args_dont_match_test.py
index 78b081d3e..8b3f2b5c7 100644
--- a/sources/pyside6/tests/signals/args_dont_match_test.py
+++ b/sources/pyside6/tests/signals/args_dont_match_test.py
@@ -54,6 +54,5 @@ class ArgsDontMatch(unittest.TestCase):
self.assertTrue(self.ok)
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/bug_311.py b/sources/pyside6/tests/signals/bug_311.py
index f05796563..0bf3cdcf3 100644
--- a/sources/pyside6/tests/signals/bug_311.py
+++ b/sources/pyside6/tests/signals/bug_311.py
@@ -41,22 +41,25 @@ init_test_paths(False)
from PySide6.QtCore import QDate, QObject, Signal
from helper.usesqcoreapplication import UsesQCoreApplication
+
class DerivedDate(QDate):
- def __init__(self,y,m,d):
- super().__init__(y,m,d)
+ def __init__(self, y, m, d):
+ super().__init__(y, m, d)
+
class Emitter(QObject):
dateSignal1 = Signal(QDate)
dateSignal2 = Signal(DerivedDate)
tupleSignal = Signal(tuple)
+
class SignaltoSignalTest(UsesQCoreApplication):
def myCb(self, dt):
self._dt = dt
def testBug(self):
e = Emitter()
- d = DerivedDate(2010,8,24)
+ d = DerivedDate(2010, 8, 24)
self._dt = None
e.dateSignal1.connect(self.myCb)
e.dateSignal1.emit(d)
@@ -73,6 +76,7 @@ class SignaltoSignalTest(UsesQCoreApplication):
e.tupleSignal.emit(myTuple)
self.assertEqual(myTuple, self._dt)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/bug_312.py b/sources/pyside6/tests/signals/bug_312.py
index d0543b68f..234e34000 100644
--- a/sources/pyside6/tests/signals/bug_312.py
+++ b/sources/pyside6/tests/signals/bug_312.py
@@ -43,6 +43,7 @@ from PySide6.QtCore import QObject, SIGNAL
MAX_LOOPS = 5
MAX_OBJECTS = 200
+
class Dummy(object):
def __init__(self, parent):
self._parent = parent
@@ -50,6 +51,7 @@ class Dummy(object):
def callback(self):
self._called = True
+
class MultipleSlots(unittest.TestCase):
def myCB(self):
self._count += 1
@@ -77,9 +79,10 @@ class MultipleSlots(unittest.TestCase):
self.assertEqual(self._count, MAX_OBJECTS)
- #delete all senders will disconnect the signals
+ # delete all senders will disconnect the signals
self._senders = []
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/bug_319.py b/sources/pyside6/tests/signals/bug_319.py
index 87dc9c053..bd46b9632 100644
--- a/sources/pyside6/tests/signals/bug_319.py
+++ b/sources/pyside6/tests/signals/bug_319.py
@@ -52,10 +52,12 @@ class Listener(QObject):
for w in words:
self._phrase.append(w)
+
class Communicate(QObject):
# create a new signal on the fly and name it 'speak'
speak = Signal(tuple)
+
class SignaltoSignalTest(UsesQCoreApplication):
def testBug(self):
someone = Communicate()
@@ -63,10 +65,11 @@ class SignaltoSignalTest(UsesQCoreApplication):
# connect signal and slot
someone.speak.connect(someone2.listen)
# emit 'speak' signal
- talk = ("one","two","three")
+ talk = ("one", "two", "three")
someone.speak.emit(talk)
self.assertEqual(someone2._phrase, list(talk))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/bug_79.py b/sources/pyside6/tests/signals/bug_79.py
index 9b91a8825..fc70ddaee 100644
--- a/sources/pyside6/tests/signals/bug_79.py
+++ b/sources/pyside6/tests/signals/bug_79.py
@@ -46,6 +46,7 @@ try:
except ImportError:
skiptest = True
+
class ConnectTest(unittest.TestCase):
def callback(self, o):
diff --git a/sources/pyside6/tests/signals/decorators_test.py b/sources/pyside6/tests/signals/decorators_test.py
index f8d51383f..346a75101 100644
--- a/sources/pyside6/tests/signals/decorators_test.py
+++ b/sources/pyside6/tests/signals/decorators_test.py
@@ -39,6 +39,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Slot, SIGNAL, SLOT
+
class MyObject(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
@@ -69,6 +70,7 @@ class MyObject(QObject):
def mySlot6(self):
self._slotCalledCount = self._slotCalledCount + 1
+
class StaticMetaObjectTest(unittest.TestCase):
def testSignalPropagation(self):
@@ -100,6 +102,7 @@ class StaticMetaObjectTest(unittest.TestCase):
m = mo.method(i)
self.assertEqual(m.typeName(), "QObject*")
+
class SlotWithoutArgs(unittest.TestCase):
def testError(self):
@@ -108,5 +111,6 @@ class SlotWithoutArgs(unittest.TestCase):
# accepting argument functions
self.assertRaises(TypeError, Slot, lambda: 3)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/disconnect_test.py b/sources/pyside6/tests/signals/disconnect_test.py
index 281bc5c66..9f97461ee 100644
--- a/sources/pyside6/tests/signals/disconnect_test.py
+++ b/sources/pyside6/tests/signals/disconnect_test.py
@@ -42,6 +42,7 @@ from testbinding import TestObject
class Foo(QObject):
bar = Signal()
+
class TestDisconnect(unittest.TestCase):
def theSlot1(self):
self.called1 = True
@@ -73,6 +74,7 @@ class TestDisconnect(unittest.TestCase):
self.called = False
obj = TestObject(0)
+
def callback():
obj.signalWithDefaultValue.disconnect(callback)
diff --git a/sources/pyside6/tests/signals/invalid_callback_test.py b/sources/pyside6/tests/signals/invalid_callback_test.py
index 33a43204f..5933aee2e 100644
--- a/sources/pyside6/tests/signals/invalid_callback_test.py
+++ b/sources/pyside6/tests/signals/invalid_callback_test.py
@@ -39,25 +39,27 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL
+
class InvalidCallback(unittest.TestCase):
'''Test case for passing an invalid callback to QObject.connect'''
def setUp(self):
- #Acquire resources
+ # Acquire resources
self.obj = QObject()
def tearDown(self):
- #Release resources
+ # Release resources
try:
del self.obj
except AttributeError:
pass
def testIntegerCb(self):
- #Test passing an int as callback to QObject.connect
+ # Test passing an int as callback to QObject.connect
self.assertRaises(TypeError, QObject.connect, self.obj,
SIGNAL('destroyed()'), 42)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/lambda_gui_test.py b/sources/pyside6/tests/signals/lambda_gui_test.py
index 0de00d7aa..e7b88ab5f 100644
--- a/sources/pyside6/tests/signals/lambda_gui_test.py
+++ b/sources/pyside6/tests/signals/lambda_gui_test.py
@@ -55,7 +55,7 @@ if hasQtGui:
class QtGuiSigLambda(UsesQApplication):
def testButton(self):
- #Connecting a lambda to a QPushButton.clicked()
+ # Connecting a lambda to a QPushButton.clicked()
obj = QPushButton('label')
ctr = Control()
func = lambda: setattr(ctr, 'arg', True)
@@ -64,9 +64,8 @@ if hasQtGui:
self.assertTrue(ctr.arg)
QObject.disconnect(obj, SIGNAL('clicked()'), func)
-
def testSpinButton(self):
- #Connecting a lambda to a QPushButton.clicked()
+ # Connecting a lambda to a QPushButton.clicked()
obj = QSpinBox()
ctr = Control()
arg = 444
diff --git a/sources/pyside6/tests/signals/lambda_test.py b/sources/pyside6/tests/signals/lambda_test.py
index ec130edee..74d5cc900 100644
--- a/sources/pyside6/tests/signals/lambda_test.py
+++ b/sources/pyside6/tests/signals/lambda_test.py
@@ -53,7 +53,7 @@ class Dummy(QObject):
class BasicCase(unittest.TestCase):
def testSimplePythonSignalNoArgs(self):
- #Connecting a lambda to a simple python signal without arguments
+ # Connecting a lambda to a simple python signal without arguments
obj = Dummy()
QObject.connect(obj, SIGNAL('foo()'),
lambda: setattr(obj, 'called', True))
@@ -61,7 +61,7 @@ class BasicCase(unittest.TestCase):
self.assertTrue(obj.called)
def testSimplePythonSignal(self):
- #Connecting a lambda to a simple python signal witharguments
+ # Connecting a lambda to a simple python signal witharguments
obj = Dummy()
arg = 42
QObject.connect(obj, SIGNAL('foo(int)'),
diff --git a/sources/pyside6/tests/signals/leaking_signal_test.py b/sources/pyside6/tests/signals/leaking_signal_test.py
index 35662b36a..3b16a3fb6 100644
--- a/sources/pyside6/tests/signals/leaking_signal_test.py
+++ b/sources/pyside6/tests/signals/leaking_signal_test.py
@@ -48,5 +48,6 @@ class LeakingSignal(unittest.TestCase):
emitter = Emitter()
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/multiple_connections_gui_test.py b/sources/pyside6/tests/signals/multiple_connections_gui_test.py
index fe879e624..153ea1e81 100644
--- a/sources/pyside6/tests/signals/multiple_connections_gui_test.py
+++ b/sources/pyside6/tests/signals/multiple_connections_gui_test.py
@@ -48,6 +48,7 @@ except ImportError:
from helper.basicpyslotcase import BasicPySlotCase
from helper.usesqapplication import UsesQApplication
+
class MultipleSignalConnections(unittest.TestCase):
'''Base class for multiple signal connection testing'''
@@ -87,7 +88,7 @@ if hasQtGui:
def testSpinBoxValueChanged(self):
"""Multiple connections to QSpinBox.valueChanged(int)"""
sender = QSpinBox()
- #FIXME if number of receivers if higher than 50, segfaults
+ # FIXME if number of receivers if higher than 50, segfaults
receivers = [BasicPySlotCase() for x in range(10)]
self.run_many(sender, 'valueChanged(int)', sender.setValue,
receivers, (1,))
diff --git a/sources/pyside6/tests/signals/multiple_connections_test.py b/sources/pyside6/tests/signals/multiple_connections_test.py
index 1f9d95c41..75f8ddc34 100644
--- a/sources/pyside6/tests/signals/multiple_connections_test.py
+++ b/sources/pyside6/tests/signals/multiple_connections_test.py
@@ -78,7 +78,8 @@ class PythonMultipleSlots(UsesQCoreApplication, MultipleSignalConnections):
sender = Dummy()
receivers = [BasicPySlotCase() for x in range(10)]
- self.run_many(sender, 'foobar(int)', partial(sender.emit,SIGNAL('foobar(int)')), receivers, (0, ))
+ self.run_many(sender, 'foobar(int)', partial(sender.emit,
+ SIGNAL('foobar(int)')), receivers, (0, ))
class QProcessMultipleSlots(UsesQCoreApplication, MultipleSignalConnections):
@@ -106,5 +107,6 @@ class QProcessMultipleSlots(UsesQCoreApplication, MultipleSignalConnections):
self.run_many(sender, 'finished(int)', start_proc, receivers, (0,))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/pysignal_test.py b/sources/pyside6/tests/signals/pysignal_test.py
index bc6310f5a..86c05324a 100644
--- a/sources/pyside6/tests/signals/pysignal_test.py
+++ b/sources/pyside6/tests/signals/pysignal_test.py
@@ -45,6 +45,7 @@ except ImportError:
from helper.usesqapplication import UsesQApplication
+
class Dummy(QObject):
"""Dummy class used in this test."""
def __init__(self, parent=None):
@@ -112,6 +113,7 @@ class PyObjectType(UsesQApplication):
self.app.exec_()
self.assertEqual(self.callCount, 2)
+
class PythonSigSlot(unittest.TestCase):
def setUp(self):
self.called = False
@@ -146,7 +148,6 @@ class PythonSigSlot(unittest.TestCase):
self.assertTrue(self.called)
-
def testDisconnect(self):
obj1 = Dummy()
diff --git a/sources/pyside6/tests/signals/qobject_destroyed_test.py b/sources/pyside6/tests/signals/qobject_destroyed_test.py
index 02298164a..6129b5c65 100644
--- a/sources/pyside6/tests/signals/qobject_destroyed_test.py
+++ b/sources/pyside6/tests/signals/qobject_destroyed_test.py
@@ -37,6 +37,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL
+
class QObjectDestroyed(unittest.TestCase):
"""Very simple test case for the destroyed() signal of QObject"""
@@ -53,5 +54,6 @@ class QObjectDestroyed(unittest.TestCase):
del obj
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/qobject_receivers_test.py b/sources/pyside6/tests/signals/qobject_receivers_test.py
index 920cd2264..4e2388e29 100644
--- a/sources/pyside6/tests/signals/qobject_receivers_test.py
+++ b/sources/pyside6/tests/signals/qobject_receivers_test.py
@@ -45,6 +45,7 @@ from PySide6.QtCore import QObject, SIGNAL, SLOT
def cute_slot():
pass
+
class TestQObjectReceivers(unittest.TestCase):
'''Test case for QObject::receivers'''
@@ -81,5 +82,6 @@ class TestQObjectReceivers(unittest.TestCase):
sender.connect(sender, SIGNAL("some_dynamic_signal()"), receiver, SLOT("deleteLater()"))
self.assertEqual(sender.receivers(SIGNAL("some_dynamic_signal( )")), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/qobject_sender_test.py b/sources/pyside6/tests/signals/qobject_sender_test.py
index 15b04dda3..6ed84a55f 100644
--- a/sources/pyside6/tests/signals/qobject_sender_test.py
+++ b/sources/pyside6/tests/signals/qobject_sender_test.py
@@ -48,6 +48,7 @@ class ExtQTimer(QTimer):
def __init__(self):
super().__init__()
+
class Receiver(QObject):
def __init__(self):
super().__init__()
@@ -58,6 +59,7 @@ class Receiver(QObject):
if QCoreApplication.instance():
QCoreApplication.instance().exit()
+
class ObjectSenderTest(unittest.TestCase):
'''Test case for QObject.sender() method.'''
@@ -68,6 +70,7 @@ class ObjectSenderTest(unittest.TestCase):
sender.emit(SIGNAL('foo()'))
self.assertEqual(sender, recv.the_sender)
+
class ObjectSenderCheckOnReceiverTest(unittest.TestCase):
'''Test case for QObject.sender() method, this one tests the equality on the Receiver object.'''
@@ -78,6 +81,7 @@ class ObjectSenderCheckOnReceiverTest(unittest.TestCase):
sender.emit(SIGNAL('foo()'))
self.assertEqual(sender, recv.the_sender)
+
class ObjectSenderWithQAppTest(UsesQCoreApplication):
'''Test case for QObject.sender() method with QApplication.'''
@@ -104,6 +108,7 @@ class ObjectSenderWithQAppTest(UsesQCoreApplication):
self.app.exec_()
self.assertEqual(sender, recv.the_sender)
+
class ObjectSenderWithQAppCheckOnReceiverTest(UsesQCoreApplication):
'''Test case for QObject.sender() method with QApplication.'''
@@ -124,6 +129,7 @@ class ObjectSenderWithQAppCheckOnReceiverTest(UsesQCoreApplication):
self.app.exec_()
self.assertEqual(sender, recv.the_sender)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/ref01_test.py b/sources/pyside6/tests/signals/ref01_test.py
index 1692a8079..bce0e8264 100644
--- a/sources/pyside6/tests/signals/ref01_test.py
+++ b/sources/pyside6/tests/signals/ref01_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Signal
+
class BoundAndUnboundSignalsTest(unittest.TestCase):
def setUp(self):
@@ -57,6 +58,7 @@ class BoundAndUnboundSignalsTest(unittest.TestCase):
self.assertNotEqual(type(obj.destroyed), Signal)
self.assertTrue(self.methods.issubset(dir(obj.destroyed)))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/ref02_test.py b/sources/pyside6/tests/signals/ref02_test.py
index 775d66b37..d516a1e67 100644
--- a/sources/pyside6/tests/signals/ref02_test.py
+++ b/sources/pyside6/tests/signals/ref02_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QCoreApplication, QTimeLine
from helper.usesqcoreapplication import UsesQCoreApplication
+
class NativeSignalsTest(UsesQCoreApplication):
def setUp(self):
@@ -78,6 +79,7 @@ class NativeSignalsTest(UsesQCoreApplication):
self.app.exec_()
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/ref03_test.py b/sources/pyside6/tests/signals/ref03_test.py
index a17d2eaa5..01fba47f9 100644
--- a/sources/pyside6/tests/signals/ref03_test.py
+++ b/sources/pyside6/tests/signals/ref03_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject
+
class DisconnectSignalsTest(unittest.TestCase):
def setUp(self):
@@ -60,6 +61,7 @@ class DisconnectSignalsTest(unittest.TestCase):
self.emitter.destroyed.disconnect(destroyedSlot)
self.assertEqual(getrefcount(destroyedSlot), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/ref04_test.py b/sources/pyside6/tests/signals/ref04_test.py
index 62f45ac73..9d3103ea7 100644
--- a/sources/pyside6/tests/signals/ref04_test.py
+++ b/sources/pyside6/tests/signals/ref04_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, Signal
+
class ExtQObject(QObject):
mySignal = Signal()
diff --git a/sources/pyside6/tests/signals/ref05_test.py b/sources/pyside6/tests/signals/ref05_test.py
index e16f7e391..5d64684dd 100644
--- a/sources/pyside6/tests/signals/ref05_test.py
+++ b/sources/pyside6/tests/signals/ref05_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QCoreApplication, QTimeLine, Slot
from helper.usesqcoreapplication import UsesQCoreApplication
+
class ExtQObject(QObject):
def __init__(self):
diff --git a/sources/pyside6/tests/signals/ref06_test.py b/sources/pyside6/tests/signals/ref06_test.py
index f86ea4b74..f6c27c9f2 100644
--- a/sources/pyside6/tests/signals/ref06_test.py
+++ b/sources/pyside6/tests/signals/ref06_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, QCoreApplication, QTimeLine, Signal, Slot
from helper.usesqcoreapplication import UsesQCoreApplication
+
class ExtQObject(QObject):
signalbetween = Signal('qreal')
diff --git a/sources/pyside6/tests/signals/segfault_proxyparent_test.py b/sources/pyside6/tests/signals/segfault_proxyparent_test.py
index 4a5847634..4a8dd0d19 100644
--- a/sources/pyside6/tests/signals/segfault_proxyparent_test.py
+++ b/sources/pyside6/tests/signals/segfault_proxyparent_test.py
@@ -47,14 +47,17 @@ from PySide6.QtCore import QObject, SIGNAL
# In PyQt4, the connection works fine with the same memory behavior,
# so it looks like specific to SIP.
+
class Dummy(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
+
class Joe(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
+
class SegfaultCase(unittest.TestCase):
"""Test case for the segfault happening when parent() is called inside
ProxyObject"""
diff --git a/sources/pyside6/tests/signals/self_connect_test.py b/sources/pyside6/tests/signals/self_connect_test.py
index 0d89d535d..96189e315 100644
--- a/sources/pyside6/tests/signals/self_connect_test.py
+++ b/sources/pyside6/tests/signals/self_connect_test.py
@@ -67,6 +67,5 @@ class SelfConnect(UsesQApplication):
self.assertTrue(not window.isVisible())
-
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/short_circuit_test.py b/sources/pyside6/tests/signals/short_circuit_test.py
index 8a9483331..d0f45891d 100644
--- a/sources/pyside6/tests/signals/short_circuit_test.py
+++ b/sources/pyside6/tests/signals/short_circuit_test.py
@@ -37,11 +37,13 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, SLOT
+
class Dummy(QObject):
"""Dummy class used in this test."""
def __init__(self, parent=None):
QObject.__init__(self, parent)
+
class ShortCircuitSignals(unittest.TestCase):
def setUp(self):
self.called = False
@@ -79,7 +81,7 @@ class ShortCircuitSignals(unittest.TestCase):
obj1 = Dummy()
QObject.connect(obj1, SIGNAL('foo(int,int,QString)'), self.callback)
- self.args = (42,33,'char')
+ self.args = (42, 33, 'char')
obj1.emit(SIGNAL('foo(int,int,QString)'), *self.args)
self.assertTrue(self.called)
@@ -94,5 +96,6 @@ class ShortCircuitSignals(unittest.TestCase):
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal2signal_connect_test.py b/sources/pyside6/tests/signals/signal2signal_connect_test.py
index 41a507fe5..05a6b6e72 100644
--- a/sources/pyside6/tests/signals/signal2signal_connect_test.py
+++ b/sources/pyside6/tests/signals/signal2signal_connect_test.py
@@ -45,18 +45,19 @@ from PySide6.QtCore import QObject, SIGNAL
def cute_slot():
pass
+
class TestSignal2SignalConnect(unittest.TestCase):
'''Test case for signal to signal connections'''
def setUp(self):
- #Set up the basic resources needed
+ # Set up the basic resources needed
self.sender = QObject()
self.forwarder = QObject()
self.args = None
self.called = False
def tearDown(self):
- #Delete used resources
+ # Delete used resources
try:
del self.sender
except:
@@ -68,24 +69,23 @@ class TestSignal2SignalConnect(unittest.TestCase):
del self.args
def callback_noargs(self):
- #Default callback without arguments
+ # Default callback without arguments
self.called = True
def callback_args(self, *args):
- #Default callback with arguments
+ # Default callback with arguments
if args == self.args:
self.called = True
else:
raise TypeError("Invalid arguments")
def callback_qobject(self, *args):
- #Default callback for QObject as argument
+ # Default callback for QObject as argument
if args[0].objectName() == self.args[0]:
self.called = True
else:
raise TypeError("Invalid arguments")
-
def testSignalWithoutArguments(self):
QObject.connect(self.sender, SIGNAL("destroyed()"),
self.forwarder, SIGNAL("forward()"))
@@ -94,7 +94,6 @@ class TestSignal2SignalConnect(unittest.TestCase):
del self.sender
self.assertTrue(self.called)
-
def testSignalWithOnePrimitiveTypeArgument(self):
QObject.connect(self.sender, SIGNAL("mysignal(int)"),
self.forwarder, SIGNAL("mysignal(int)"))
@@ -104,7 +103,6 @@ class TestSignal2SignalConnect(unittest.TestCase):
self.sender.emit(SIGNAL('mysignal(int)'), *self.args)
self.assertTrue(self.called)
-
def testSignalWithMultiplePrimitiveTypeArguments(self):
QObject.connect(self.sender, SIGNAL("mysignal(int,int)"),
self.forwarder, SIGNAL("mysignal(int,int)"))
@@ -114,7 +112,6 @@ class TestSignal2SignalConnect(unittest.TestCase):
self.sender.emit(SIGNAL('mysignal(int,int)'), *self.args)
self.assertTrue(self.called)
-
def testSignalWithOneStringArgument(self):
QObject.connect(self.sender, SIGNAL("mysignal(QString)"),
self.forwarder, SIGNAL("mysignal(QString)"))
@@ -124,7 +121,6 @@ class TestSignal2SignalConnect(unittest.TestCase):
self.sender.emit(SIGNAL('mysignal(QString)'), *self.args)
self.assertTrue(self.called)
-
def testSignalWithOneQObjectArgument(self):
QObject.connect(self.sender, SIGNAL('destroyed(QObject*)'),
self.forwarder, SIGNAL('forward(QObject*)'))
diff --git a/sources/pyside6/tests/signals/signal_autoconnect_test.py b/sources/pyside6/tests/signals/signal_autoconnect_test.py
index 3f12c8994..6c95aa74c 100644
--- a/sources/pyside6/tests/signals/signal_autoconnect_test.py
+++ b/sources/pyside6/tests/signals/signal_autoconnect_test.py
@@ -63,5 +63,6 @@ class AutoConnectionTest(unittest.TestCase):
btn.click()
self.assertTrue(win._method_called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_connectiontype_support_test.py b/sources/pyside6/tests/signals/signal_connectiontype_support_test.py
index e984492b6..23ad6a5c5 100644
--- a/sources/pyside6/tests/signals/signal_connectiontype_support_test.py
+++ b/sources/pyside6/tests/signals/signal_connectiontype_support_test.py
@@ -37,11 +37,13 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, Qt
+
class Dummy(QObject):
"""Dummy class used in this test."""
def __init__(self, parent=None):
QObject.__init__(self, parent)
+
class TestConnectionTypeSupport(unittest.TestCase):
def callback(self, *args):
if tuple(self.args) == args:
diff --git a/sources/pyside6/tests/signals/signal_emission_gui_test.py b/sources/pyside6/tests/signals/signal_emission_gui_test.py
index f4aa7c856..c13a74e94 100644
--- a/sources/pyside6/tests/signals/signal_emission_gui_test.py
+++ b/sources/pyside6/tests/signals/signal_emission_gui_test.py
@@ -137,7 +137,7 @@ if hasQtGui:
spinSend.emit(SIGNAL('valueChanged(int)'), 3)
self.assertEqual(spinRec.value(), 3)
- #Direct emission shouldn't change the value of the emitter
+ # Direct emission shouldn't change the value of the emitter
self.assertEqual(spinSend.value(), 42)
spinSend.emit(SIGNAL('valueChanged(int)'), 66)
diff --git a/sources/pyside6/tests/signals/signal_emission_test.py b/sources/pyside6/tests/signals/signal_emission_test.py
index 550804c12..faca38ccc 100644
--- a/sources/pyside6/tests/signals/signal_emission_test.py
+++ b/sources/pyside6/tests/signals/signal_emission_test.py
@@ -63,10 +63,12 @@ class MoreArgsOnEmit(UsesQCoreApplication):
process = QProcess()
self.assertRaises(TypeError, process.emit, SIGNAL('finished(int)'), 55, 55)
+
class Dummy(QObject):
'''Dummy class'''
pass
+
class PythonSignalToCppSlots(UsesQCoreApplication):
'''Connect python signals to C++ slots'''
@@ -95,8 +97,9 @@ class PythonSignalToCppSlots(UsesQCoreApplication):
timeline, SLOT('setCurrentTime(int)'))
current = timeline.currentTime()
- dummy.emit(SIGNAL('dummy(int)'), current+42)
- self.assertEqual(timeline.currentTime(), current+42)
+ dummy.emit(SIGNAL('dummy(int)'), current + 42)
+ self.assertEqual(timeline.currentTime(), current + 42)
+
class CppSignalsToCppSlots(UsesQCoreApplication):
'''Connection between C++ slots and signals'''
@@ -121,11 +124,15 @@ class CppSignalsToCppSlots(UsesQCoreApplication):
else:
self.assertEqual(new_dir, QTimeLine.Forward)
+
called = False
+
+
def someSlot(args=None):
global called
called = True
+
class DynamicSignalsToFuncPartial(UsesQCoreApplication):
def testIt(self):
@@ -136,12 +143,14 @@ class DynamicSignalsToFuncPartial(UsesQCoreApplication):
o.emit(SIGNAL("ASignal()"))
self.assertTrue(called)
+
class EmitUnknownType(UsesQCoreApplication):
def testIt(self):
a = QObject()
- a.connect(SIGNAL('foobar(Dummy)'), lambda x: 42) # Just connect with an unknown type
+ a.connect(SIGNAL('foobar(Dummy)'), lambda x: 42) # Just connect with an unknown type
self.assertRaises(TypeError, a.emit, SIGNAL('foobar(Dummy)'), 22)
+
class EmitEnum(UsesQCoreApplication):
"""Test emission of enum arguments"""
@@ -155,5 +164,6 @@ class EmitEnum(UsesQCoreApplication):
p.stateChanged.emit(QProcess.NotRunning)
self.assertEqual(self.arg, QProcess.NotRunning)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_enum_test.py b/sources/pyside6/tests/signals/signal_enum_test.py
index d7e67052f..1a598270e 100644
--- a/sources/pyside6/tests/signals/signal_enum_test.py
+++ b/sources/pyside6/tests/signals/signal_enum_test.py
@@ -45,6 +45,7 @@ class Colors(Enum):
green = 2
blue = 3
+
class Obj(QObject):
enum_signal = Signal(Colors)
object_signal = Signal(object)
diff --git a/sources/pyside6/tests/signals/signal_func_test.py b/sources/pyside6/tests/signals/signal_func_test.py
index 7e8c8f762..cd37a69a9 100644
--- a/sources/pyside6/tests/signals/signal_func_test.py
+++ b/sources/pyside6/tests/signals/signal_func_test.py
@@ -39,18 +39,20 @@ init_test_paths(False)
from PySide6.QtCore import SIGNAL, SLOT
+
class SIGNALSLOTTests(unittest.TestCase):
'''Test the output of SIGNAL and SLOT.'''
def testSIGNAL(self):
- #SIGNAL function
+ # SIGNAL function
a = "foobar"
self.assertEqual(str(SIGNAL(a)), "2foobar")
def testSLOT(self):
- #SLOT function
+ # SLOT function
a = "foobar"
self.assertEqual(str(SLOT(a)), "1foobar")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_manager_refcount_test.py b/sources/pyside6/tests/signals/signal_manager_refcount_test.py
index 5bc1b30db..e304d01e3 100644
--- a/sources/pyside6/tests/signals/signal_manager_refcount_test.py
+++ b/sources/pyside6/tests/signals/signal_manager_refcount_test.py
@@ -41,6 +41,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL
+
class SignalManagerRefCount(unittest.TestCase):
"""Simple test case to check if the signal_manager is erroneously incrementing the object refcounter"""
@@ -55,6 +56,7 @@ class SignalManagerRefCount(unittest.TestCase):
QObject.disconnect(obj, SIGNAL('destroyed()'), callback)
self.assertEqual(refcount, getrefcount(obj))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_number_limit_test.py b/sources/pyside6/tests/signals/signal_number_limit_test.py
index 6f54b73de..3534610a6 100644
--- a/sources/pyside6/tests/signals/signal_number_limit_test.py
+++ b/sources/pyside6/tests/signals/signal_number_limit_test.py
@@ -57,6 +57,7 @@ class Emitter(QObject):
s13 = Signal()
s14 = Signal()
+
class SignalNumberLimitTest(unittest.TestCase):
def myCb(self):
self._count += 1
@@ -95,5 +96,6 @@ class SignalNumberLimitTest(unittest.TestCase):
e.s14.emit()
self.assertEqual(self._count, 14)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_object_test.py b/sources/pyside6/tests/signals/signal_object_test.py
index 629a2e7f8..4df20f5d0 100644
--- a/sources/pyside6/tests/signals/signal_object_test.py
+++ b/sources/pyside6/tests/signals/signal_object_test.py
@@ -40,6 +40,7 @@ init_test_paths(False)
from PySide6.QtCore import QTimer, Signal, QObject, Slot, Qt
from helper.usesqcoreapplication import UsesQCoreApplication
+
class MyObject(QTimer):
sig1 = Signal()
sig2 = Signal(int, name='rangeChanged')
@@ -118,5 +119,6 @@ class SignalObjectTest(UsesQCoreApplication):
o.sig6.emit(arg)
self.assertEqual(arg, o._o)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/signal_signature_test.py b/sources/pyside6/tests/signals/signal_signature_test.py
index 9aaa6c58b..5cf9fad61 100644
--- a/sources/pyside6/tests/signals/signal_signature_test.py
+++ b/sources/pyside6/tests/signals/signal_signature_test.py
@@ -45,9 +45,12 @@ from helper.usesqcoreapplication import UsesQCoreApplication
called = False
name = "Old"
+
+
class Obj(QObject):
dummySignalArgs = Signal(str)
numberSignal = Signal(int)
+
def __init__(self):
super().__init__()
self.signal = ''
@@ -65,11 +68,15 @@ class Obj(QObject):
global name
name = arg
+
def callback(arg=None):
pass
+
+
def callback_empty():
pass
+
class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication):
'''Test case for signal signature received by QObject::connectNotify().'''
@@ -103,7 +110,6 @@ class TestConnectNotifyWithNewStyleSignals(UsesQCoreApplication):
sender.emit(SIGNAL("dummySignal()"))
self.assertTrue(called)
-
def testStaticSlotArgs(self):
global name
sender = Obj()
diff --git a/sources/pyside6/tests/signals/signal_with_primitive_type_test.py b/sources/pyside6/tests/signals/signal_with_primitive_type_test.py
index 993386985..dbf059a1d 100644
--- a/sources/pyside6/tests/signals/signal_with_primitive_type_test.py
+++ b/sources/pyside6/tests/signals/signal_with_primitive_type_test.py
@@ -60,6 +60,7 @@ class SignalPrimitiveTypeTest(unittest.TestCase):
self._app.exec_()
self.assertTrue(self.called)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/slot_reference_count_test.py b/sources/pyside6/tests/signals/slot_reference_count_test.py
index 419cf9fb3..757cd20cb 100644
--- a/sources/pyside6/tests/signals/slot_reference_count_test.py
+++ b/sources/pyside6/tests/signals/slot_reference_count_test.py
@@ -40,10 +40,12 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, SLOT
+
class Dummy(QObject):
def dispatch(self):
self.emit(SIGNAL('foo()'))
+
class PythonSignalRefCount(unittest.TestCase):
def setUp(self):
@@ -64,6 +66,7 @@ class PythonSignalRefCount(unittest.TestCase):
QObject.disconnect(self.emitter, SIGNAL('foo()'), cb)
self.assertEqual(getrefcount(cb), 2)
+
class CppSignalRefCount(unittest.TestCase):
def setUp(self):
@@ -84,5 +87,6 @@ class CppSignalRefCount(unittest.TestCase):
QObject.disconnect(self.emitter, SIGNAL('destroyed()'), cb)
self.assertEqual(getrefcount(cb), 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/signals/static_metaobject_test.py b/sources/pyside6/tests/signals/static_metaobject_test.py
index 280a8b49c..dbb3aecfa 100644
--- a/sources/pyside6/tests/signals/static_metaobject_test.py
+++ b/sources/pyside6/tests/signals/static_metaobject_test.py
@@ -42,6 +42,7 @@ init_test_paths(False)
from PySide6.QtCore import QObject, SIGNAL, Slot
from helper.usesqcoreapplication import UsesQCoreApplication
+
class MyObject(QObject):
def __init__(self, parent=None):
QObject.__init__(self, parent)
@@ -76,7 +77,6 @@ class StaticMetaObjectTest(UsesQCoreApplication):
# The SIGNAL was destroyed with old objects
self.assertEqual(o.metaObject().indexOfSignal("foo()"), -1)
-
def testSharedSignalEmission(self):
o = QObject()
m = MyObject()
@@ -89,5 +89,6 @@ class StaticMetaObjectTest(UsesQCoreApplication):
m.emit(SIGNAL("foo2()"))
self.assertEqual(m._slotCalledCount, 2)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/support/voidptr_test.py b/sources/pyside6/tests/support/voidptr_test.py
index 72bdeb8d4..bf19de07c 100644
--- a/sources/pyside6/tests/support/voidptr_test.py
+++ b/sources/pyside6/tests/support/voidptr_test.py
@@ -39,6 +39,7 @@ from shiboken6 import Shiboken
from PySide6.support import VoidPtr
from PySide6.QtCore import QByteArray
+
class PySide6Support(unittest.TestCase):
def testVoidPtr(self):
@@ -68,5 +69,6 @@ class PySide6Support(unittest.TestCase):
mv[6:11] = b'void*'
self.assertEqual(str(ba), str(b"Hello void*"))
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside6/tests/tools/list-class-hierarchy.py b/sources/pyside6/tests/tools/list-class-hierarchy.py
index 03b49bbb4..924706457 100644
--- a/sources/pyside6/tests/tools/list-class-hierarchy.py
+++ b/sources/pyside6/tests/tools/list-class-hierarchy.py
@@ -48,12 +48,13 @@ ignore = ["staticMetaObject",
"thread",
]
-def recurse_into(el,obj):
+
+def recurse_into(el, obj):
#s = el.split('.')[-1]
#pdb.set_trace()
symbols = []
for item in sorted(dir(obj)):
- if item[0]=='_':
+ if item[0] == '_':
continue
mel = el + '.' + item
try:
@@ -67,10 +68,11 @@ def recurse_into(el,obj):
symbols.append(mel)
if isclass(mobj):
- symbols += recurse_into(mel,mobj)
+ symbols += recurse_into(mel, mobj)
return symbols
+
if __name__=='__main__':
modules = [ 'QtCore',
'QtGui',
@@ -91,15 +93,15 @@ if __name__=='__main__':
librarySymbols = {}
for l in libraries:
dictionary = []
- if l =="PyQt5":
+ if l == "PyQt5":
import sip
- sip.setapi('QDate',2)
- sip.setapi('QDateTime',2)
- sip.setapi('QString',2)
- sip.setapi('QTextStream',2)
- sip.setapi('QTime',2)
- sip.setapi('QUrl',2)
- sip.setapi('QVariant',2)
+ sip.setapi('QDate', 2)
+ sip.setapi('QDateTime', 2)
+ sip.setapi('QString', 2)
+ sip.setapi('QTextStream', 2)
+ sip.setapi('QTime', 2)
+ sip.setapi('QUrl', 2)
+ sip.setapi('QVariant', 2)
for m in modules:
exec(f"from {l} import {m}", globals(), locals())
diff --git a/sources/pyside6/tests/util/color.py b/sources/pyside6/tests/util/color.py
index 1602fbb00..aee452ad8 100644
--- a/sources/pyside6/tests/util/color.py
+++ b/sources/pyside6/tests/util/color.py
@@ -32,6 +32,7 @@
def print_colored(message):
print(f'\033[0;31m{message}\033[m') # red
+
if __name__ == '__main__':
print('42 - the answer')
print_colored("But what's the question?")
diff --git a/sources/pyside6/tests/util/httpd.py b/sources/pyside6/tests/util/httpd.py
index 2cbaa130e..dbd78aeb8 100644
--- a/sources/pyside6/tests/util/httpd.py
+++ b/sources/pyside6/tests/util/httpd.py
@@ -55,6 +55,7 @@ class TestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header("Content-Length", str(len(TestHandler.DATA)))
self.end_headers()
+
class TestSecureHandler(BaseHTTPServer.BaseHTTPRequestHandler):
DATA = "PySide"
allow_reuse_address = True
@@ -78,6 +79,8 @@ class TestSecureHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.end_headers()
# Workaround for the missing shutdown method in python2.5
+
+
class CompatTCPServer(SocketServer.TCPServer):
def __init__(self, server_address, RequestHandlerClass):
SocketServer.TCPServer.__init__(self, server_address, RequestHandlerClass)
@@ -158,7 +161,7 @@ class TestServer(threading.Thread):
while True:
try:
- self.httpd = CompatTCPServer(('' , self._port), handle)
+ self.httpd = CompatTCPServer(('', self._port), handle)
break
except:
self._port = self._port + random.randint(1, 100)
diff --git a/sources/pyside6/tests/util/processtimer.py b/sources/pyside6/tests/util/processtimer.py
index 067f1d29c..35102e592 100644
--- a/sources/pyside6/tests/util/processtimer.py
+++ b/sources/pyside6/tests/util/processtimer.py
@@ -28,50 +28,53 @@
##
#############################################################################
-import time,os
+import os
+import time
+
class TimeoutException(Exception):
- def __init__(self, msg):
- self.msg = msg
+ def __init__(self, msg):
+ self.msg = msg
+
+ def __str__(self):
+ return repr(self.msg)
- def __str__(self):
- return repr(self.msg)
class ProcessTimer(object):
- '''Timeout function for controlling a subprocess.Popen instance.
+ '''Timeout function for controlling a subprocess.Popen instance.
- Naive implementation using busy loop, see later other means
- of doing this.
- '''
+ Naive implementation using busy loop, see later other means
+ of doing this.
+ '''
- def __init__(self, proc, timeout):
- self.proc = proc
- self.timeout = timeout
+ def __init__(self, proc, timeout):
+ self.proc = proc
+ self.timeout = timeout
- def waitfor(self):
- time_passed = 0
- while(self.proc.poll() is None and time_passed < self.timeout):
- time_passed = time_passed + 1
- time.sleep(1)
+ def waitfor(self):
+ time_passed = 0
+ while(self.proc.poll() is None and time_passed < self.timeout):
+ time_passed = time_passed + 1
+ time.sleep(1)
- if time_passed >= self.timeout:
- raise TimeoutException("Timeout expired, possible deadlock")
+ if time_passed >= self.timeout:
+ raise TimeoutException("Timeout expired, possible deadlock")
-if __name__ == "__main__":
- #simple example
- from subprocess import Popen
+if __name__ == "__main__":
+ # simple example
- proc = Popen(['sleep','10'])
- t = ProcessTimer(proc,5)
- try:
- t.waitfor()
- except TimeoutException:
- print(f"timeout - PID: {t.proc.pid}")
- #TODO: detect SO and kill accordingly
- #Linux
- os.kill(t.proc.pid, 9)
- #Windows (not tested)
- #subprocess.Popen("taskkill /F /T /PID %i"%handle.pid , shell=True)
- print(f"exit code: {t.proc.poll()}")
+ from subprocess import Popen
+ proc = Popen(['sleep', '10'])
+ t = ProcessTimer(proc, 5)
+ try:
+ t.waitfor()
+ except TimeoutException:
+ print(f"timeout - PID: {t.proc.pid}")
+ #TODO: detect SO and kill accordingly
+ #Linux
+ os.kill(t.proc.pid, 9)
+ #Windows (not tested)
+ #subprocess.Popen("taskkill /F /T /PID %i"%handle.pid , shell=True)
+ print(f"exit code: {t.proc.poll()}")
diff --git a/sources/pyside6/tests/util/pyqt_diff.py b/sources/pyside6/tests/util/pyqt_diff.py
index 380fd08e0..ca10ef049 100644
--- a/sources/pyside6/tests/util/pyqt_diff.py
+++ b/sources/pyside6/tests/util/pyqt_diff.py
@@ -32,6 +32,7 @@ import sys
from color import print_colored
+
def check_module_diff(module_name):
'''Difference between PySide6 and PyQt5 versions of qt bindings.
Returns a tuple with the members present only on PySide6 and only on PyQt5'''
@@ -58,5 +59,6 @@ def main(argv=None):
print_colored('Only on SIP version')
print(only_orig)
+
if __name__ == '__main__':
main()
diff --git a/sources/pyside6/tests/util/test_processtimer.py b/sources/pyside6/tests/util/test_processtimer.py
index ba3e99775..026e14b6b 100644
--- a/sources/pyside6/tests/util/test_processtimer.py
+++ b/sources/pyside6/tests/util/test_processtimer.py
@@ -34,6 +34,7 @@ import os
from subprocess import Popen, PIPE
from processtimer import TimeoutException, ProcessTimer
+
class TimeoutTest(unittest.TestCase):
def tearDown(self):
@@ -43,10 +44,11 @@ class TimeoutTest(unittest.TestCase):
pass
def testRaise(self):
- self.proc = Popen(['python2.5', '-c', 'while True: pass' ], stdout=PIPE, stderr=PIPE)
+ self.proc = Popen(['python2.5', '-c', 'while True: pass'], stdout=PIPE, stderr=PIPE)
timer = ProcessTimer(self.proc, 1)
self.assertRaises(TimeoutException, timer.waitfor)
+
class SimpleTest(unittest.TestCase):
def tearDown(self):
@@ -54,11 +56,13 @@ class SimpleTest(unittest.TestCase):
os.kill(self.proc.pid, 9)
except OSError:
pass
+
def testSimple(self):
self.proc = Popen(['python2.5', '-c', '"print"'], stdout=PIPE, stderr=PIPE)
timer = ProcessTimer(self.proc, 10)
timer.waitfor()
+
class TestEchoOutput(unittest.TestCase):
def tearDown(self):
@@ -73,6 +77,7 @@ class TestEchoOutput(unittest.TestCase):
timer.waitfor()
self.assertEqual(self.proc.stdout.read().strip(), '1')
+
class TestRetCode(unittest.TestCase):
def tearDown(self):