Skip to content
Snippets Groups Projects
Commit 2473de84 authored by Ladislav Lhotka's avatar Ladislav Lhotka
Browse files

Fix GitHub issue #66

parent c0ad2868
Branches
Tags 1.3.57
No related merge requests found
Pipeline #72896 passed with stages
in 2 minutes and 40 seconds
PROJECT = yangson
VERSION = 1.3.56
VERSION = 1.3.57
.PHONY = tags deps install-deps test
tags:
......
......@@ -204,7 +204,11 @@ def test_types(data_model):
# type conversions
def tctest(typ, raw, text, value):
assert (typ.from_raw(raw) == typ.parse_value(text) == value)
lj = data_model.get_data_node(
"/test:contA/listA/contD/contE/leafJ").type
llb = data_model.get_data_node("/test:llistB").type
assert (None,) in lj
assert lj.to_raw((None,)) == [None]
assert "192.168.1.254" in llb
assert "300.1.1.1" not in llb
assert "127.0.1" not in llb
......
......@@ -258,6 +258,9 @@ class EmptyType(DataType):
if raw == [None]:
return (None,)
def to_raw(self, val: Tuple[None]) -> List[None]:
return [None]
def from_xml(self, xml: str) -> Optional[Tuple[None]]:
if xml == '':
return (None,)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment