Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 25, 2018. It is now read-only.

Commit

Permalink
have get_random_object return negative numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
rfk committed Apr 4, 2011
1 parent 5207d40 commit 1e42cab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tnetstring/tests/test_format.py
Expand Up @@ -58,7 +58,10 @@ def get_random_object(random=random,depth=0,jsonsafe=False):
if what == 2: if what == 2:
return False return False
if what == 3: if what == 3:
return random.randint(0,sys.maxint) if random.randint(0,1) == 0:
return random.randint(0,sys.maxint)
else:
return -1 * random.randint(0,sys.maxint)
# cjson can't reliably round-trip floats. # cjson can't reliably round-trip floats.
if what == 4 and not jsonsafe: if what == 4 and not jsonsafe:
return random.randint(0,sys.maxint)*1.0/random.randint(0,sys.maxint) return random.randint(0,sys.maxint)*1.0/random.randint(0,sys.maxint)
Expand Down

0 comments on commit 1e42cab

Please sign in to comment.