mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
15 lines
379 B
Python
15 lines
379 B
Python
from testutils import assert_raises
|
|
|
|
assert format(5, "b") == "101"
|
|
|
|
assert_raises(TypeError, lambda: format(2, 3), 'format called with number')
|
|
|
|
assert format({}) == "{}"
|
|
|
|
assert_raises(TypeError, lambda: format({}, 'b'), 'format_spec not empty for dict')
|
|
|
|
class BadFormat:
|
|
def __format__(self, spec):
|
|
return 42
|
|
assert_raises(TypeError, lambda: format(BadFormat()))
|