Merge pull request #3811 from zer0who/hoo_rustpython

added getnewargs() to str.rs
This commit is contained in:
fanninpm
2022-07-14 09:32:50 -04:00
committed by GitHub
5 changed files with 5 additions and 34 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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__()

View File

@@ -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 {