danielgtaylor / danielgtaylor/python-betterproto

_get_field_default_gen does not return the correct generator when freezegun is in use

Open
#403 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.8k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

The function `_get_field_default_gen` checks if a field's type is a datetime using `t is datetime`, which means if freezegun is being used in a test it generates the wrong default generator function.

Suggest this changes to `t instanceof datetime` to support cases like this.

Contributor guide

Open the contributing guide

Research direction

Locate `_get_field_default_gen` in the betterproto generator and inspect how it identifies datetime field types. Reproduce the behavior with freezegun, then verify that the generated default handling is correct for both ordinary and freezegun-wrapped datetime types.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.