示例#1
0
def test_integer_with_decimal():
    assert typecast.integer('.') is None
    assert typecast.integer('1.0') == 1
    assert typecast.integer('25.923432') == 25
示例#2
0
def test_integer_money_str():
    assert typecast.integer('$125') == 125
    assert typecast.integer('$125.00') == 125
    assert typecast.integer('$125.75') == 125
示例#3
0
def test_integer():
    assert typecast.integer(10) == 10
    assert typecast.integer('10') == 10
    assert typecast.integer('  10  ') == 10
    assert typecast.integer('') is None
    assert typecast.integer('NOT AN INTEGER') is None