bugdantic 0.4.3__tar.gz → 0.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bugdantic-0.4.3 → bugdantic-0.4.4}/PKG-INFO +1 -1
- {bugdantic-0.4.3 → bugdantic-0.4.4}/bugdantic/bugzilla.py +13 -4
- {bugdantic-0.4.3 → bugdantic-0.4.4}/bugdantic.egg-info/PKG-INFO +1 -1
- {bugdantic-0.4.3 → bugdantic-0.4.4}/pyproject.toml +1 -1
- {bugdantic-0.4.3 → bugdantic-0.4.4}/test/test_bugzilla.py +13 -0
- {bugdantic-0.4.3 → bugdantic-0.4.4}/LICENSE +0 -0
- {bugdantic-0.4.3 → bugdantic-0.4.4}/README.md +0 -0
- {bugdantic-0.4.3 → bugdantic-0.4.4}/bugdantic/__init__.py +0 -0
- {bugdantic-0.4.3 → bugdantic-0.4.4}/bugdantic/py.typed +0 -0
- {bugdantic-0.4.3 → bugdantic-0.4.4}/bugdantic/userstory.py +0 -0
- {bugdantic-0.4.3 → bugdantic-0.4.4}/bugdantic.egg-info/SOURCES.txt +0 -0
- {bugdantic-0.4.3 → bugdantic-0.4.4}/bugdantic.egg-info/dependency_links.txt +0 -0
- {bugdantic-0.4.3 → bugdantic-0.4.4}/bugdantic.egg-info/requires.txt +0 -0
- {bugdantic-0.4.3 → bugdantic-0.4.4}/bugdantic.egg-info/top_level.txt +0 -0
- {bugdantic-0.4.3 → bugdantic-0.4.4}/setup.cfg +0 -0
- {bugdantic-0.4.3 → bugdantic-0.4.4}/test/test_userstory.py +0 -0
|
@@ -455,10 +455,19 @@ def bug_search_model(bug_type: type[BugType]) -> type[BugSearchGeneric[BugType]]
|
|
|
455
455
|
|
|
456
456
|
|
|
457
457
|
def model_field_names(model: type[BaseModel]) -> list[str]:
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
458
|
+
field_names = []
|
|
459
|
+
for name, field_obj in model.model_fields.items():
|
|
460
|
+
if field_obj.validation_alias is not None:
|
|
461
|
+
if not isinstance(field_obj.validation_alias, str):
|
|
462
|
+
raise ValueError(
|
|
463
|
+
"Only string values for validation_alias are supported"
|
|
464
|
+
)
|
|
465
|
+
field_names.append(field_obj.validation_alias)
|
|
466
|
+
elif field_obj.alias is not None:
|
|
467
|
+
field_names.append(field_obj.alias)
|
|
468
|
+
else:
|
|
469
|
+
field_names.append(name)
|
|
470
|
+
return field_names
|
|
462
471
|
|
|
463
472
|
|
|
464
473
|
class Bugzilla:
|
|
@@ -80,3 +80,16 @@ def test_bug_as_alias(bugzilla):
|
|
|
80
80
|
assert isinstance(result, BugData)
|
|
81
81
|
assert result.id == 975444
|
|
82
82
|
assert result.user_story is not None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def test_bug_as_validation_alias(bugzilla):
|
|
86
|
+
class BugData(BaseModel):
|
|
87
|
+
id: int
|
|
88
|
+
user_story: str = Field(
|
|
89
|
+
validation_alias="cf_user_story", alias="raw_user_story"
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
result = bugzilla.bug_as(975444, BugData)
|
|
93
|
+
assert isinstance(result, BugData)
|
|
94
|
+
assert result.id == 975444
|
|
95
|
+
assert result.user_story is not None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|