summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@novell.com>2010-06-18 15:31:40 +0200
committerThorsten Behrens <tbehrens@novell.com>2010-06-18 15:31:40 +0200
commitdaea655716bf86609b5704108c18fe8a39f1f831 (patch)
treee96422915ed4edaf2067168cfed315384bba0042
parent86b1a27f7e7c582a737063bfcf763ce548d97049 (diff)
Added missing base type fuzzers, fixed numFromStr setup
-rw-r--r--pyxb/binding/datatypes.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/pyxb/binding/datatypes.py b/pyxb/binding/datatypes.py
index bd2dd72..cd08319 100644
--- a/pyxb/binding/datatypes.py
+++ b/pyxb/binding/datatypes.py
@@ -155,9 +155,9 @@ class decimal (basis.simpleTypeDefinition, types.FloatType):
@classmethod
def _fuzz_vx (cls, value):
- value = unicode(value)
+ value = str(value)
modPos = random.randint(0,len(value)-1) if len(value) > 1 else 0
- return cls(value[:modPos] + chr((long(value[modPos])+1) % 10) + value[modPos+1:])
+ return cls(value[:modPos] + str((long(value[modPos])+1) % 10) + value[modPos+1:])
_PrimitiveDatatypes.append(decimal)
@@ -1031,6 +1031,12 @@ class integer (basis.simpleTypeDefinition, types.LongType):
def XsdLiteral (cls, value):
return '%d' % (value,)
+ @classmethod
+ def _fuzz_vx (cls, value):
+ value = str(value)
+ modPos = random.randint(0,len(value)-1) if len(value) > 1 else 0
+ return cls(value[:modPos] + str((long(value[modPos])+1) % 10) + value[modPos+1:])
+
_DerivedDatatypes.append(integer)
class nonPositiveInteger (integer):
@@ -1053,6 +1059,12 @@ class int (basis.simpleTypeDefinition, types.IntType):
def XsdLiteral (cls, value):
return '%s' % (value,)
+ @classmethod
+ def _fuzz_vx (cls, value):
+ value = str(value)
+ modPos = random.randint(0,len(value)-1) if len(value) > 1 else 0
+ return cls(value[:modPos] + str((long(value[modPos])+1) % 10) + value[modPos+1:])
+
pass
_DerivedDatatypes.append(int)