Fix test_typing.test_args_kwargs (#6012)

This commit is contained in:
Jeong, YunWon authored and GitHub committed 2025-07-21 16:54:27 +09:00
1 parent a1ee7f5461
commit bd7947ec8f
2 files changed
+10 -10

No files matched your search

-2
View File
@@ -8546,8 +8546,6 @@ class ParamSpecTests(BaseTestCase):
self.assertEqual(C4.__args__, (P, T))
self.assertEqual(C4.__parameters__, (P, T))
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_args_kwargs(self):
P = ParamSpec('P')
P_2 = ParamSpec('P_2')
+10 -8
View File
@@ -833,11 +833,12 @@ impl Comparable for ParamSpecArgs {
fn eq(
zelf: &crate::Py<ParamSpecArgs>,
other: PyObjectRef,
vm: &VirtualMachine,
_vm: &VirtualMachine,
) -> PyResult<bool> {
// Check if other has __origin__ attribute
if let Ok(other_origin) = other.get_attr("__origin__", vm) {
return Ok(zelf.__origin__.is(&other_origin));
// First check if other is also ParamSpecArgs
if let Ok(other_args) = other.downcast::<ParamSpecArgs>() {
// Check if they have the same origin
return Ok(zelf.__origin__.is(&other_args.__origin__));
}
Ok(false)
}
@@ -911,11 +912,12 @@ impl Comparable for ParamSpecKwargs {
fn eq(
zelf: &crate::Py<ParamSpecKwargs>,
other: PyObjectRef,
vm: &VirtualMachine,
_vm: &VirtualMachine,
) -> PyResult<bool> {
// Check if other has __origin__ attribute
if let Ok(other_origin) = other.get_attr("__origin__", vm) {
return Ok(zelf.__origin__.is(&other_origin));
// First check if other is also ParamSpecKwargs
if let Ok(other_kwargs) = other.downcast::<ParamSpecKwargs>() {
// Check if they have the same origin
return Ok(zelf.__origin__.is(&other_kwargs.__origin__));
}
Ok(false)
}