@@ -23,8 +23,8 @@ def __init__(self, parent=None):
23
23
"""the __init__ method.
24
24
25
25
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.
28
28
The new widget is deleted when its parent is deleted.
29
29
30
30
"""
@@ -97,10 +97,14 @@ def setSingleStep(self, singleStep):
97
97
Args:
98
98
singleStep (int): new _singleStep value. converts negativ values to positiv ones.
99
99
100
+ Raises:
101
+ TypeError: If the given argument is not an integer.
102
+
100
103
Returns:
101
- True if all went fine .
104
+ int or long: the absolute value of the given argument .
102
105
"""
103
- assert isinstance (singleStep , int ), "not of type int"
106
+ if not isinstance (singleStep , int ):
107
+ raise TypeError ("Argument is not of type int" )
104
108
# don't use negative values
105
109
self ._singleStep = abs (singleStep )
106
110
return self ._singleStep
@@ -113,9 +117,13 @@ def setMinimum(self, minimum):
113
117
"""setter to _minimum.
114
118
115
119
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.
117
124
"""
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" )
119
127
self ._minimum = minimum
120
128
121
129
def maximum (self ):
@@ -127,6 +135,7 @@ def setMaximum(self, maximum):
127
135
128
136
Args:
129
137
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" )
132
141
self ._maximum = maximum
0 commit comments