mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Added NonNegativeInteger.
This commit is contained in:
parent
b4f7b878cf
commit
a2feec9ac0
@ -299,18 +299,19 @@ class Integer(Value):
|
||||
except ValueError:
|
||||
self.error()
|
||||
|
||||
class PositiveInteger(Value):
|
||||
class PositiveInteger(Integer):
|
||||
"""Value must be positive (non-zero) integer."""
|
||||
def set(self, s):
|
||||
try:
|
||||
self.setValue(int(s))
|
||||
except ValueError:
|
||||
self.error()
|
||||
|
||||
def setValue(self, v):
|
||||
if v <= 0:
|
||||
self.error()
|
||||
Value.setValue(self, v)
|
||||
Integer.setValue(self, v)
|
||||
|
||||
class NonNegativeInteger(Integer):
|
||||
"""Value must not be negative."""
|
||||
def setValue(self, v):
|
||||
if v < 0:
|
||||
self.error()
|
||||
Integer.setValue(self, v)
|
||||
|
||||
class Float(Value):
|
||||
"""Value must be a floating-point number."""
|
||||
|
Loading…
Reference in New Issue
Block a user