Use assert() functions in the unit tests for the sake of standardization
This commit is contained in:
parent
65f6f78008
commit
fc68cd2248
2 changed files with 11 additions and 8 deletions
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from PySide import QtGui, QtCore
|
from PySide import QtCore
|
||||||
|
from PySide import QtGui
|
||||||
from helper import UsesQApplication
|
from helper import UsesQApplication
|
||||||
|
|
||||||
class Item(QtGui.QGraphicsItem):
|
class Item(QtGui.QGraphicsItem):
|
||||||
|
|
@ -21,8 +22,8 @@ class Item(QtGui.QGraphicsItem):
|
||||||
class QGraphicsViewIsBlockedTest(UsesQApplication):
|
class QGraphicsViewIsBlockedTest(UsesQApplication):
|
||||||
|
|
||||||
def testIsBlockedByModalPanel(self):
|
def testIsBlockedByModalPanel(self):
|
||||||
item = Item()
|
(bool, object) = Item().isBlockedByModalPanel()
|
||||||
item.isBlockedByModalPanel()
|
self.assertFalse(bool)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -6,19 +6,21 @@ from helper import UsesQApplication, TimedQApplication
|
||||||
class TestInputDialog(TimedQApplication):
|
class TestInputDialog(TimedQApplication):
|
||||||
|
|
||||||
def testGetDouble(self):
|
def testGetDouble(self):
|
||||||
QtGui.QInputDialog.getDouble(None, "title", "label")
|
self.assertEquals(QtGui.QInputDialog.getDouble(None, "title", "label"), (0.0, False))
|
||||||
|
|
||||||
def testGetInt(self):
|
def testGetInt(self):
|
||||||
QtGui.QInputDialog.getInt(None, "title", "label")
|
self.assertEquals(QtGui.QInputDialog.getInt(None, "title", "label"), (0, False))
|
||||||
|
|
||||||
def testGetInteger(self):
|
def testGetInteger(self):
|
||||||
QtGui.QInputDialog.getInteger(None, "title", "label")
|
self.assertEquals(QtGui.QInputDialog.getInteger(None, "title", "label"), (0, False))
|
||||||
|
|
||||||
def testGetItem(self):
|
def testGetItem(self):
|
||||||
QtGui.QInputDialog.getItem(None, "title", "label", QtCore.QStringList(["1", "2", "3"]))
|
(item, bool) = QtGui.QInputDialog.getItem(None, "title", "label", QtCore.QStringList(["1", "2", "3"]))
|
||||||
|
self.assertEquals(str(item), "1")
|
||||||
|
|
||||||
def testGetText(self):
|
def testGetText(self):
|
||||||
QtGui.QInputDialog.getText(None, "title", "label")
|
(text, bool) = QtGui.QInputDialog.getText(None, "title", "label")
|
||||||
|
self.assertEquals(str(text),"")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue