Skip to content

Commit d68d5a2

Browse files
committed
Merge pull request #3 from quiqua/tests_refactoring
Refactored code and added more tests
2 parents a53d27c + f5599ee commit d68d5a2

13 files changed

+981
-264
lines changed

examples/TestApp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ def __init__(self, parent=None):
7474
self.tableViewColumnDtypes = QtGui.QTableView(self)
7575
self.rightLayout.addWidget(QtGui.QLabel('dtypes'))
7676
self.rightLayout.addWidget(self.tableViewColumnDtypes)
77-
self.buttonGotToColumn = QtGui.QPushButton("got to column")
78-
self.rightLayout.addWidget(self.buttonGotToColumn)
79-
self.buttonGotToColumn.clicked.connect(self.gotToColumn)
77+
self.buttonGoToColumn = QtGui.QPushButton("go to column")
78+
self.rightLayout.addWidget(self.buttonGoToColumn)
79+
self.buttonGoToColumn.clicked.connect(self.goToColumn)
8080

8181
self.buttonSetFilter = QtGui.QPushButton("set filter")
8282
self.rightLayout.addWidget(self.buttonSetFilter)
@@ -123,8 +123,8 @@ def updateDelegates(self, column=None):
123123
print "update delegate for column", column
124124
self.delegates = setDelegatesFromDtype(self.dataTableView)
125125

126-
def gotToColumn(self):
127-
print "go to column"
126+
def goToColumn(self):
127+
print "go to column 7"
128128
index = self.dataTableView.model().index(7, 0)
129129
self.dataTableView.setCurrentIndex(index)
130130

pandasqt/BigIntSpinbox.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def __init__(self, parent=None):
2323
"""the __init__ method.
2424
2525
Args:
26-
parent (QObject): defaults to None. If parent is 0, the new widget becomes a window.
27-
If parent is another widget, this widget becomes a child window inside parent.
26+
parent (QObject): defaults to None. If parent is 0, the new widget becomes a window.
27+
If parent is another widget, this widget becomes a child window inside parent.
2828
The new widget is deleted when its parent is deleted.
2929
3030
"""
@@ -97,10 +97,14 @@ def setSingleStep(self, singleStep):
9797
Args:
9898
singleStep (int): new _singleStep value. converts negativ values to positiv ones.
9999
100+
Raises:
101+
TypeError: If the given argument is not an integer.
102+
100103
Returns:
101-
True if all went fine.
104+
int or long: the absolute value of the given argument.
102105
"""
103-
assert isinstance(singleStep, int), "not of type int"
106+
if not isinstance(singleStep, int):
107+
raise TypeError("Argument is not of type int")
104108
# don't use negative values
105109
self._singleStep = abs(singleStep)
106110
return self._singleStep
@@ -113,9 +117,13 @@ def setMinimum(self, minimum):
113117
"""setter to _minimum.
114118
115119
Args:
116-
minimum (int or long): new _minimum value
120+
minimum (int or long): new _minimum value.
121+
122+
Raises:
123+
TypeError: If the given argument is not an integer.
117124
"""
118-
assert isinstance(minimum, int) or isinstance(minimum, long), "not of type int or long"
125+
if not isinstance(minimum, (int, long)):
126+
raise TypeError("Argument is not of type int or long")
119127
self._minimum = minimum
120128

121129
def maximum(self):
@@ -127,6 +135,7 @@ def setMaximum(self, maximum):
127135
128136
Args:
129137
maximum (int or long): new _maximum value
130-
"""
131-
assert isinstance(maximum, int) or isinstance(maximum, long), "not of type int or long"
138+
"""
139+
if not isinstance(maximum, (int, long)):
140+
raise TypeError("Argument is not of type int or long")
132141
self._maximum = maximum

0 commit comments

Comments
 (0)