mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Fix repr for union
This commit is contained in:
2
Lib/test/test_types.py
vendored
2
Lib/test/test_types.py
vendored
@@ -929,8 +929,6 @@ class UnionTests(unittest.TestCase):
|
||||
assert typing.Optional[int] | str == typing.Union[int, str, None]
|
||||
assert typing.Union[int, bool] | str == typing.Union[int, bool, str]
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_or_type_repr(self):
|
||||
assert repr(int | str) == "int | str"
|
||||
assert repr((int | str) | list) == "int | str | list"
|
||||
|
||||
@@ -43,7 +43,7 @@ impl PyUnion {
|
||||
#[pymethod(magic)]
|
||||
fn repr(&self, vm: &VirtualMachine) -> PyResult<String> {
|
||||
fn repr_item(obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<String> {
|
||||
if vm.is_none(&obj) {
|
||||
if obj.is(vm.ctx.types.none_type) {
|
||||
return Ok("None".to_string());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user