Skip to content

Commit

Permalink
Added docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Egil Moeller committed May 15, 2015
1 parent dd56a2a commit 8ab3ecf
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions test/testutils.py
Expand Up @@ -14,11 +14,11 @@

precision = 5.0

def TextToNumber(s):
def TextToNumber(text):
try:
return float(s)
return float(text)
except (TypeError, ValueError):
return s
return text


def IsNumber(value):
Expand All @@ -30,6 +30,20 @@ def IsNumber(value):


def DictDiff(a, b):
"""Compares two dictionaries. Intended to be used in a test to
compare the actual return value from some function with a
known-good value.
Returns a dictionary with the following keys:
removed: Dict of all key/value pairs in a but not in b.
added: Dict of all key/value pairs in b but not in a.
changed: Dict with all keys with different values in a and b.
Values are pairs of the values from a and b.
"""

def Compare(x, y):
if x == y:
return True
Expand Down

0 comments on commit 8ab3ecf

Please sign in to comment.