From f1c850edb0bf7ff2fdc116221cec48c4d97b51e2 Mon Sep 17 00:00:00 2001 From: Gourab Singha Date: Sat, 27 Jun 2026 18:12:02 +0530 Subject: [PATCH 1/2] Fix unknown properties returning None instead of raising AttributeError --- Adyen/services/base.py | 3 +++ test/ClientTest.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/Adyen/services/base.py b/Adyen/services/base.py index 2f4a20d4..e4923481 100644 --- a/Adyen/services/base.py +++ b/Adyen/services/base.py @@ -14,6 +14,9 @@ def __getattr__(self, attr): client_attr = ["username", "password", "platform"] if attr in client_attr: return self.client[attr] + raise AttributeError( + f"'{self.__class__.__name__}' object has no attribute '{attr}'" + ) class AdyenServiceBase(AdyenBase): diff --git a/test/ClientTest.py b/test/ClientTest.py index d0b8c195..5f81e0ad 100644 --- a/test/ClientTest.py +++ b/test/ClientTest.py @@ -17,3 +17,9 @@ class TestClient(unittest.TestCase): client.xapikey = "YOUR_API_KEY" client.platform = "test" lib_version = settings.LIB_VERSION + + def test_unknown_properties_raise_attribute_error(self): + with self.assertRaises(AttributeError): + _ = self.adyen.foobar + with self.assertRaises(AttributeError): + _ = self.adyen.payment.payments_api.foobar From 00a0335616c3067f6c2c66cae9ac2d0102f1f600 Mon Sep 17 00:00:00 2001 From: Gourab Singha Date: Sat, 27 Jun 2026 18:14:32 +0530 Subject: [PATCH 2/2] Resolve parent attributes outside assertRaises to prevent false positives --- test/ClientTest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/ClientTest.py b/test/ClientTest.py index 5f81e0ad..831a7a40 100644 --- a/test/ClientTest.py +++ b/test/ClientTest.py @@ -21,5 +21,7 @@ class TestClient(unittest.TestCase): def test_unknown_properties_raise_attribute_error(self): with self.assertRaises(AttributeError): _ = self.adyen.foobar + # Resolve parent attributes outside of assertRaises to avoid false positives + payments_api = self.adyen.payment.payments_api with self.assertRaises(AttributeError): - _ = self.adyen.payment.payments_api.foobar + _ = payments_api.foobar