rustpython 0.1.0

A python interpreter written in rust.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()))