mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
test_class.py: testTypeAttributeAccessErrorMessages fix
This commit is contained in:
committed by
Jeong, YunWon
parent
61feb43aba
commit
27a52a7962
2
Lib/test/test_class.py
vendored
2
Lib/test/test_class.py
vendored
@@ -629,8 +629,6 @@ class ClassTests(unittest.TestCase):
|
||||
with self.assertRaises(TypeError):
|
||||
type.__setattr__(A, b'x', None)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def testTypeAttributeAccessErrorMessages(self):
|
||||
class A:
|
||||
pass
|
||||
|
||||
@@ -1082,10 +1082,11 @@ impl SetAttr for PyType {
|
||||
} else {
|
||||
let prev_value = zelf.attributes.write().shift_remove(attr_name); // TODO: swap_remove applicable?
|
||||
if prev_value.is_none() {
|
||||
return Err(vm.new_exception(
|
||||
vm.ctx.exceptions.attribute_error.to_owned(),
|
||||
vec![attr_name.to_object()],
|
||||
));
|
||||
return Err(vm.new_attribute_error(format!(
|
||||
"type object '{}' has no attribute '{}'",
|
||||
zelf.name(),
|
||||
attr_name.as_str(),
|
||||
)));
|
||||
}
|
||||
}
|
||||
if attr_name.as_str().starts_with("__") && attr_name.as_str().ends_with("__") {
|
||||
|
||||
Reference in New Issue
Block a user