bito-code-review[bot] commented on PR #44817:
URL: https://github.com/apache/superset/pull/44817#issuecomment-5926908843

   <!-- Bito Reply -->
   Yes, creating a standalone mypy fixture is an excellent way to verify this 
type inference. By defining a minimal class using `UUIDMixin` and asserting the 
type of `Dashboard.uuid` (or an instance's `.uuid` attribute) in a test file, 
you can ensure that mypy correctly identifies it as `UUID | None` without 
relying on the full repository context. If the `@declared_attr` implementation 
is reverted, the type would likely revert to `Any` or `Column[Any]`, causing 
the assertion to fail and confirming the regression is caught.
   
   **tests/mypy_test_uuid.py**
   ```
   from typing import Optional
   from uuid import UUID
   from superset.models.helpers import UUIDMixin
   
   class Dashboard(UUIDMixin):
       pass
   
   def test_uuid_type() -> None:
       # Mypy should infer this as UUID | None
       uuid_val: Optional[UUID] = Dashboard().uuid
       reveal_type(Dashboard().uuid)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to