Skip to content
Merged

Dev #303

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

2.19.0 (2026-02-14)
-------------------

- feat: python 3.14 support added.
- fix: wrapped does not inherit ns, nsmap from inner entity.


2.18.0 (2025-10-11)
-------------------
Expand Down
2 changes: 1 addition & 1 deletion pydantic_xml/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

def merge_field_infos(*field_infos: pd.fields.FieldInfo) -> pd.fields.FieldInfo:
if PYDANTIC_VERSION >= (2, 12, 0):
return pd.fields.FieldInfo._construct(field_infos) # type: ignore[attr-defined]
return pd.fields.FieldInfo._construct(list(field_infos))
else:
return pd.fields.FieldInfo.merge_field_infos(*field_infos)
7 changes: 6 additions & 1 deletion pydantic_xml/fields.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import copy
import dataclasses as dc
import typing
from typing import Any, Callable, Dict, Optional, Union
Expand Down Expand Up @@ -196,9 +197,13 @@ def wrapped(
field_info = pd.fields.FieldInfo(default=default, default_factory=default_factory, **kwargs)
else:
wrapped_entity_info = extract_field_xml_entity_info(entity)
field_info = copy.deepcopy(entity)
# wrapped must not inherit ns, nsmap from inner entity
field_info.metadata = [item for item in field_info.metadata if not isinstance(item, XmlEntityInfo)]

field_info = compat.merge_field_infos(
pd.fields.FieldInfo(default=default, default_factory=default_factory, **kwargs),
entity,
field_info,
)

field_info.metadata.append(
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pydantic-xml"
version = "2.18.0"
version = "2.19.0"
description = "pydantic xml extension"
authors = ["Dmitry Pershin <dapper1291@gmail.com>"]
license = "Unlicense"
Expand Down Expand Up @@ -29,6 +29,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Typing :: Typed",
]

Expand All @@ -54,7 +55,7 @@ mypy = "^1.4.1"
pre-commit = "~3.2.0"
pytest = "^7.4.0"
pytest-cov = "^4.1.0"
xmldiff = "2.5"
xmldiff = "^2.7.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
4 changes: 4 additions & 0 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ def assert_xml_equal(
right: Union[str, bytes],
*,
ignore_comments: bool = True,
ignore_namespace: bool = True,
pretty: bool = True,
**kwargs,
):
diffs = xmldiff.main.diff_texts(left, right, **kwargs)

if ignore_comments:
diffs = list(filter(lambda diff: not isinstance(diff, xmldiff.actions.InsertComment), diffs))
if ignore_namespace:
ns_actions = (xmldiff.actions.InsertNamespace, xmldiff.actions.DeleteNamespace)
diffs = list(filter(lambda diff: not isinstance(diff, ns_actions), diffs))

if diffs:
if pretty:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_namespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class TestModel(BaseTestModel, tag='model', ns='tst', nsmap={'tst': 'http://test
pass

xml1 = '''
<tst:model xmlns:tst="http://test1.org" attr1="1">
<tst:model xmlns:bs="http://base.org" xmlns:tst="http://test1.org" attr1="1">
<tst:element1>value</tst:element1>
</tst:model>
'''
Expand Down