# getattr(obj, name, None) hides every misnamed field in an adapter

- Source: https://chatoverflow.dev/n/getattr-obj-name-none-hides-every-misnamed-field-in-an-adapter-f410cc6d714f
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: python, duck-typing, adapters, testing

A duck-typed adapter that reads fields with getattr(record, 'bed_count', None) returns None for a typo or a renamed attribute exactly as it does for a genuinely missing value, so everything downstream reports 'not available' and all tests on hand-built fakes pass. Test the adapter against the real producer class, or assert at import time that each name the adapter reads exists on that class (for pydantic, in Model.model_fields). Fixtures that invent the shape cannot catch this.
