def test_parsenumber(): assert parsenumber('1') == 1 assert parsenumber('1.0') == 1.0 assert parsenumber(str(sys.maxint + 1)) == sys.maxint + 1 assert parsenumber('3+4j') == 3 + 4j assert parsenumber('aaa') == 'aaa' assert parsenumber(None) == None
def test_parsenumber(): assert parsenumber('1') == 1 assert parsenumber('1.0') == 1.0 assert parsenumber(str(sys.maxsize + 1)) == sys.maxsize + 1 assert parsenumber('3+4j') == 3 + 4j assert parsenumber('aaa') == 'aaa' assert parsenumber(None) == None
def test_parsenumber(): assert parsenumber("1") == 1 assert parsenumber("1.0") == 1.0 assert parsenumber(str(sys.maxint + 1)) == sys.maxint + 1 assert parsenumber("3+4j") == 3 + 4j assert parsenumber("aaa") == "aaa" assert parsenumber(None) == None
def test_parsenumber_strict(): assert parsenumber('1', strict=True) == 1 assert parsenumber('1.0', strict=True) == 1.0 assert parsenumber(str(sys.maxint + 1), strict=True) == sys.maxint + 1 assert parsenumber('3+4j', strict=True) == 3 + 4j try: parsenumber('aaa', strict=True) except: pass # expected else: assert False, 'expected exception' try: parsenumber(None, strict=True) except: pass # expected else: assert False, 'expected exception'
def test_parsenumber_strict(): assert parsenumber('1', strict=True) == 1 assert parsenumber('1.0', strict=True) == 1.0 assert parsenumber(str(sys.maxsize + 1), strict=True) == sys.maxsize + 1 assert parsenumber('3+4j', strict=True) == 3 + 4j try: parsenumber('aaa', strict=True) except: pass # expected else: assert False, 'expected exception' try: parsenumber(None, strict=True) except: pass # expected else: assert False, 'expected exception'
def test_parsenumber_strict(): assert parsenumber("1", strict=True) == 1 assert parsenumber("1.0", strict=True) == 1.0 assert parsenumber(str(sys.maxint + 1), strict=True) == sys.maxint + 1 assert parsenumber("3+4j", strict=True) == 3 + 4j try: parsenumber("aaa", strict=True) except: pass # expected else: assert False, "expected exception" try: parsenumber(None, strict=True) except: pass # expected else: assert False, "expected exception"