mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Merge pull request #3811 from zer0who/hoo_rustpython
added getnewargs() to str.rs
This commit is contained in:
2
Lib/test/test_enum.py
vendored
2
Lib/test/test_enum.py
vendored
@@ -1002,8 +1002,6 @@ class TestEnum(unittest.TestCase):
|
||||
self.assertIn(e, SummerMonth)
|
||||
self.assertIs(type(e), SummerMonth)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_subclassing(self):
|
||||
if isinstance(Name, Exception):
|
||||
raise Name
|
||||
|
||||
20
Lib/test/test_pickle.py
vendored
20
Lib/test/test_pickle.py
vendored
@@ -118,16 +118,6 @@ class PyPicklerTests(AbstractPickleTests, unittest.TestCase):
|
||||
def test_nested_names(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_nested_names() # TODO: RUSTPYTHON, remove when this passes
|
||||
|
||||
# TODO: RUSTPYTHON, AssertionError
|
||||
@unittest.expectedFailure
|
||||
def test_newobj_generic(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_newobj_generic() # TODO: RUSTPYTHON, remove when this passes
|
||||
|
||||
# TODO: RUSTPYTHON, TypeError: cannot pickle 'weakproxy' object
|
||||
@unittest.expectedFailure
|
||||
def test_newobj_proxies(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_newobj_proxies() # TODO: RUSTPYTHON, remove when this passes
|
||||
|
||||
def test_notimplemented(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_notimplemented() # TODO: RUSTPYTHON, remove when this passes
|
||||
|
||||
@@ -233,16 +223,6 @@ class InMemoryPickleTests(AbstractPickleTests, AbstractUnpickleTests,
|
||||
def test_nested_names(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_nested_names() # TODO: RUSTPYTHON, remove when this passes
|
||||
|
||||
# TODO: RUSTPYTHON, AssertionError: 'hello' != '' : 'hello' is not a copy of ''
|
||||
@unittest.expectedFailure
|
||||
def test_newobj_generic(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_newobj_generic() # TODO: RUSTPYTHON, remove when this passes
|
||||
|
||||
# TODO: RUSTPYTHON, TypeError: cannot pickle 'weakproxy' object
|
||||
@unittest.expectedFailure
|
||||
def test_newobj_proxies(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_newobj_proxies() # TODO: RUSTPYTHON, remove when this passes
|
||||
|
||||
def test_notimplemented(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_notimplemented() # TODO: RUSTPYTHON, remove when this passes
|
||||
|
||||
|
||||
10
Lib/test/test_pickletools.py
vendored
10
Lib/test/test_pickletools.py
vendored
@@ -40,16 +40,6 @@ class OptimizedPickleTests(AbstractPickleTests, unittest.TestCase):
|
||||
def test_nested_names(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_nested_names()
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_newobj_generic(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_newobj_generic()
|
||||
|
||||
# TODO: RUSTPYTHON, TypeError: cannot pickle 'weakproxy' object
|
||||
@unittest.expectedFailure
|
||||
def test_newobj_proxies(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_newobj_proxies()
|
||||
|
||||
def test_notimplemented(self): # TODO: RUSTPYTHON, remove when this passes
|
||||
super().test_notimplemented()
|
||||
|
||||
|
||||
2
Lib/test/test_unicode.py
vendored
2
Lib/test/test_unicode.py
vendored
@@ -2392,8 +2392,6 @@ class UnicodeTest(string_tests.CommonTest,
|
||||
s += "4"
|
||||
self.assertEqual(s, "3")
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_getnewargs(self):
|
||||
text = 'abc'
|
||||
args = text.__getnewargs__()
|
||||
|
||||
@@ -1258,6 +1258,11 @@ impl PyStr {
|
||||
fn encode(zelf: PyRef<Self>, args: EncodeArgs, vm: &VirtualMachine) -> PyResult<PyBytesRef> {
|
||||
encode_string(zelf, args.encoding, args.errors, vm)
|
||||
}
|
||||
|
||||
#[pymethod(magic)]
|
||||
fn getnewargs(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyObjectRef {
|
||||
(zelf.as_str(),).to_pyobject(vm)
|
||||
}
|
||||
}
|
||||
|
||||
impl PyStrRef {
|
||||
|
||||
Reference in New Issue
Block a user