| assert_eq(int('1'), 1) |
| assert_eq(int('-1234'), -1234) |
| assert_eq(int(42), 42) |
| assert_eq(int(-1), -1) |
| assert_eq(int(True), 1) |
| assert_eq(int(False), 0) |
| assert_eq(int('11', 2), 3) |
| assert_eq(int('11', 9), 10) |
| assert_eq(int('AF', 16), 175) |
| assert_eq(int('11', 36), 37) |
| assert_eq(int('az', 36), 395) |
| assert_eq(int('11', 10), 11) |
| assert_eq(int('11', 0), 11) |
| assert_eq(int('0b11', 0), 3) |
| assert_eq(int('0B11', 2), 3) |
| assert_eq(int('0o11', 0), 9) |
| assert_eq(int('0O11', 8), 9) |
| assert_eq(int('0XFF', 0), 255) |
| assert_eq(int('0xFF', 16), 255) |
| |
| --- |
| int('1.5') ### invalid literal for int\(\) with base 10 |
| --- |
| int('ab') ### invalid literal for int\(\) with base 10: "ab" |
| --- |
| int(None) ### parameter 'x' cannot be None |
| --- |
| int('123', 3) ### invalid literal for int\(\) with base 3: "123" |
| --- |
| int('FF', 15) ### invalid literal for int\(\) with base 15: "FF" |
| --- |
| int('123', -1) ### int\(\) base must be >= 2 and <= 36 |
| --- |
| int('123', 1) ### int\(\) base must be >= 2 and <= 36 |
| --- |
| int('123', 37) ### int\(\) base must be >= 2 and <= 36 |
| --- |
| int('0xFF', 8) ### invalid literal for int\(\) with base 8: "0xFF" |
| --- |
| int(True, 2) ### int\(\) can't convert non-string with explicit base |
| --- |
| int(1, 2) ### int\(\) can't convert non-string with explicit base |
| --- |
| int(True, 10) ### int\(\) can't convert non-string with explicit base |