bgr / PyQt5_modeltest

PyQt5 port of modeltest.py
GNU General Public License v2.0
7 stars 3 forks source link

ModelTest provides a way to check for common errors in implementations of http://doc.trolltech.com/4/qabstractitemmodel.html.

ModelTest continuously checks a model as it changes, helping to verify the state and catching many common errors the moment they show up such as:


To Use the model test do the following:

1) Include the modeltest.py file in your project directory

2) Then in your source import "modeltest" and instantiate ModelTest with your model so the test can live for the lifetime of your model. For example:

from modeltest import ModelTest

self.model = QDirModel(self) self.modeltest = ModelTest(self.model, self);

3) That is it. When the test finds a problem it will throw an AssertionError. modeltest.py contains some hints on how to fix problems that the test finds.