[Bug]: Unknown properties return None
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 48/100
調査の方向性
Issueで特定された根本原因の箇所であるAdyen/services/base.pyの13-16行目から開始します。AdyenBaseのサブクラスで属性が存在しない例を再現し、不明なキーがどのように処理されるかを調べます。ネストされたAPIオブジェクトも含め、存在しない属性がNoneを返すのではなくAttributeErrorを発生させれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
Accessing a non-existent property on an API returns None instead of raising an AttributeError
Steps to reproduce
Attempt to access any non-existent attribute on any subclass of AdyenBase
>>> from Adyen import Adyen
>>> api = Adyen(xapikey='token', platform='test')
>>> print(api.foobar)
None
>>> print(api.payment.payments_api.foobar)
None
>>> api.payment.payments_api.fizz()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable
Actual behavior
Attempting to access non-existent attribute returns None. Attempting to call a non-existent method throws a "NoneType object is not callable" error.
Expected behavior
Should return an AttributeError.
Code snippet or screenshots (if applicable)
Root cause is here:
If key doesn't exist in self.client, the method exits with no return statement, which is the same as returning None. This means any attribute that's requested defaults to None. It should instead raise AttributeError
Adyen Python API Library version
14.0.0
Python Language version
Python 3.10
Operating System
macOS
Additional context
No response
- 主要言語
- Python
- スター
- 68
- フォーク
- 51
- 平均マージ
- 2時間 3分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Adyen/adyen-python-api-library のほかの issue
-
[Bug] api_*_version override has no effect on PAL-based service URLs対応中かも @cobanfurkanx が 10 日前に担当しました。 オープンBug do not stale
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Feature
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
Adyen/adyen-python-api-library#487 · コメント 1 件 · リアクション 1 件 ·
-
[Test] Add baseUrl environment tests to all service test files対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdo not stale Test
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
-
chore: consolidate package metadata into pyproject.toml (PEP 621)対応中かも @erdemtuna が 192 日前に担当しました。 オープンdo not stale
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
-
do not stale Feature
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
Adyen/adyen-python-api-library#395 · リアクション 1 件 ·
Adyen/adyen-python-api-library の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
UKGovernmentBEIS/control-arena#917 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
debpalash/VoiceStudio#2937 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws-samples/sample-per-model-bedrock#261 ·
メンテナーはふだん 1 日以内に返信