def test_fromdecimalstr(self): x = rbigint.fromdecimalstr("12345678901234567890523897987") assert x.tolong() == 12345678901234567890523897987L assert x.tobool() is True x = rbigint.fromdecimalstr("+12345678901234567890523897987") assert x.tolong() == 12345678901234567890523897987L assert x.tobool() is True x = rbigint.fromdecimalstr("-12345678901234567890523897987") assert x.tolong() == -12345678901234567890523897987L assert x.tobool() is True x = rbigint.fromdecimalstr("+0") assert x.tolong() == 0 assert x.tobool() is False x = rbigint.fromdecimalstr("-0") assert x.tolong() == 0 assert x.tobool() is False
def fromdecimalstr(s): return W_LongObject(rbigint.fromdecimalstr(s))