pyRegRep 9__tar.gz → 10__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyRegRep
3
- Version: 9
3
+ Version: 10
4
4
  Summary: Your package description
5
5
  Author: Andrey Shapovalov
6
6
  Author-email: mt.andrey@gmail.com
@@ -290,4 +290,4 @@ MIT License — див. файл [LICENSE](LICENSE)
290
290
 
291
291
  ---
292
292
 
293
- **Версія:** 9 · **Оновлено:** 2026-03-11
293
+ **Версія:** 10 · **Оновлено:** 2026-03-11
@@ -278,4 +278,4 @@ MIT License — див. файл [LICENSE](LICENSE)
278
278
 
279
279
  ---
280
280
 
281
- **Версія:** 9 · **Оновлено:** 2026-03-11
281
+ **Версія:** 10 · **Оновлено:** 2026-03-11
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyRegRep
3
- Version: 9
3
+ Version: 10
4
4
  Summary: Your package description
5
5
  Author: Andrey Shapovalov
6
6
  Author-email: mt.andrey@gmail.com
@@ -290,4 +290,4 @@ MIT License — див. файл [LICENSE](LICENSE)
290
290
 
291
291
  ---
292
292
 
293
- **Версія:** 9 · **Оновлено:** 2026-03-11
293
+ **Версія:** 10 · **Оновлено:** 2026-03-11
@@ -13,6 +13,7 @@ class NS:
13
13
  "rs": "urn:oasis:names:tc:ebxml-regrep:xsd:rs:4.0",
14
14
  "xsi": "http://www.w3.org/2001/XMLSchema-instance",
15
15
  "xsd": "http://www.w3.org/2001/XMLSchema",
16
+ "xml": "http://www.w3.org/XML/1998/namespace",
16
17
  }
17
18
 
18
19
  def __init__(self):
@@ -27,7 +27,8 @@ class Xml(NS):
27
27
  if self._element is not None:
28
28
  self._create_element()
29
29
 
30
- def _create_element(self): ...
30
+ def _create_element(self):
31
+ ...
31
32
 
32
33
  @property
33
34
  def element(self) -> etree._Element:
@@ -151,14 +152,18 @@ class _InternationalStringValueType(Xml):
151
152
  def _intenation_element(self, item: dict) -> etree._Element | None:
152
153
  if "lang" in item and "text" in item:
153
154
  element = etree.Element(
154
- self._tname("rim", "LocalizedString"), attrib={"lang": item["lang"]}
155
+ self._tname("rim", "LocalizedString"),
156
+ attrib={
157
+ self._tname("xml", "lang"): item["lang"],
158
+ "value": item["text"]
159
+ }
155
160
  )
156
- element.text = item["text"]
157
161
  return element
158
162
  else:
159
163
  _logger.warning(f"Invalid item format for InternationalStringValueType: {item}")
160
164
  return None
161
165
 
166
+
162
167
  def get_slot(name: str, slot_type: str, value: Any) -> Xml:
163
168
  """
164
169
  Фабрична функція для створення RIM слотів на базі типу.
@@ -31,6 +31,6 @@ __all__ = [
31
31
  "_InternationalStringValueType",
32
32
  ]
33
33
 
34
- __version__ = "9"
34
+ __version__ = "10"
35
35
  __author__ = "Andrey Shapovalov"
36
36
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyRegRep"
7
- version = "9"
7
+ version = "10"
8
8
  description = "Your package description"
9
9
  authors = [{ name="Andrey Shapovalov" }]
10
10
  readme = "README.md"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pyRegRep",
5
- version="9",
5
+ version="10",
6
6
  description="Бібліотека для роботи з реєстрами та репозитаріями в Україні",
7
7
  packages=find_packages(),
8
8
  license="MIT",
@@ -310,6 +310,7 @@ class TestInternationalStringValueType:
310
310
 
311
311
  def test_list_of_dicts(self):
312
312
  """List of dicts with 'lang'/'text' keys creates LocalizedString elements."""
313
+ XML_NS = "http://www.w3.org/XML/1998/namespace"
313
314
  data = [
314
315
  {"lang": "en", "text": "Hello"},
315
316
  {"lang": "uk", "text": "Привіт"},
@@ -321,11 +322,11 @@ class TestInternationalStringValueType:
321
322
  value_el = slot.element.find(".//{*}SlotValue/{*}Value")
322
323
  assert value_el is not None
323
324
  assert len(value_el) == 2
324
- # Verify lang attributes
325
- langs = {child.attrib.get("lang") for child in value_el}
325
+ # lang is stored as {http://www.w3.org/XML/1998/namespace}lang attribute
326
+ langs = {child.attrib.get(f"{{{XML_NS}}}lang") for child in value_el}
326
327
  assert langs == {"en", "uk"}
327
- # Verify text
328
- texts = {child.text for child in value_el}
328
+ # text is stored in "value" attribute (not .text)
329
+ texts = {child.attrib.get("value") for child in value_el}
329
330
  assert "Hello" in texts
330
331
  assert "Привіт" in texts
331
332
 
@@ -351,6 +352,7 @@ class TestInternationalStringValueType:
351
352
 
352
353
  def test_list_mixed_elements_and_dicts(self):
353
354
  """List may contain both etree._Element and dict items."""
355
+ XML_NS = "http://www.w3.org/XML/1998/namespace"
354
356
  e = etree.Element("LocalizedString")
355
357
  e.attrib["lang"] = "en"
356
358
  e.text = "From element"
@@ -362,6 +364,10 @@ class TestInternationalStringValueType:
362
364
 
363
365
  value_el = slot.element.find(".//{*}SlotValue/{*}Value")
364
366
  assert len(value_el) == 2
367
+ # dict item stores lang as xml:lang attribute
368
+ dict_child = value_el[1]
369
+ assert dict_child.attrib.get(f"{{{XML_NS}}}lang") == "uk"
370
+ assert dict_child.attrib.get("value") == "Від словника"
365
371
 
366
372
  def test_list_with_unsupported_type_skipped(self, caplog):
367
373
  """Non-Element, non-dict items in list are skipped with a warning."""
File without changes
File without changes
File without changes
File without changes