The ImportError fallback set ContextTypes = Any, but then ContextTypes.DEFAULT_TYPE was used as a type annotation at class definition time — Any doesn't have .DEFAULT_TYPE, causing AttributeError. Fix: create a _MockContextTypes class with DEFAULT_TYPE = Any. Also stub CommandHandler, TelegramMessageHandler, filters, ParseMode, and ChatType to prevent potential NameErrors. Fixes #304.