add: initial evs support

This commit is contained in:
Istvan Ruzman
2022-02-21 16:36:52 +01:00
parent 10d7f0b7f4
commit d970df0dd7
4 changed files with 152 additions and 99 deletions

View File

@@ -119,7 +119,8 @@ def test_valid_attribute_numbers(number):
@pytest.mark.parametrize(
"invalid_number", ["1000", "ABCD", "-1", "inf", "INF", "-INF", "2e4", "2.5e3"],
"invalid_number",
["1000", "ABCD", "-1", "inf", "INF", "-INF", "2e4", "2.5e3"],
)
def test_invalid_attribute_numbers(invalid_number):
dictionary = StringIO(f"ATTRIBUTE NAME {invalid_number} integer64")
@@ -247,7 +248,6 @@ def test_value_number_out_of_limit(value_num, attr_type):
"tlv",
"extended",
"long-extended",
"evs",
],
)
def test_all_datatypes_rfc_space(datatype):
@@ -255,6 +255,11 @@ def test_all_datatypes_rfc_space(datatype):
Dictionary("", dictionary)
def test_evs_datatype():
dictionary = StringIO("ATTRIBUTE TEST-ATTRIBUTE 1.10 evs\n")
Dictionary("", dictionary)
@pytest.mark.parametrize(
"datatype",
[
@@ -299,7 +304,8 @@ def test_invalid_datatypes_in_vendor_space(datatype):
@pytest.mark.parametrize(
"invalid_number", ["ABCD", "-1", "inf", "INF", "-INF", "0.1", "2e4", "2.5e3"],
"invalid_number",
["ABCD", "-1", "inf", "INF", "-INF", "0.1", "2e4", "2.5e3"],
)
def test_invalid_value_numbers(invalid_number):
dictionary = StringIO(
@@ -401,3 +407,16 @@ def test_get_nonexisting_attributes_from_dictionaries(attribute):
dd = Dictionary("", dictionary)
with pytest.raises(KeyError):
_ = dd[attribute]
def test_extended_evs():
dictionary = StringIO(
"ATTRIBUTE RFC-EXTENDED 10 extended\n"
"ATTRIBUTE RFC-EXTENDED-EVS 10.20 evs\n"
"VENDOR TEST-VENDOR 1234\n"
"BEGIN-VENDOR TEST-VENDOR format=RFC-EXTENDED-EVS\n"
"ATTRIBUTE VENDOR-ATTRIBUTE 10 integer\n"
"END-VENDOR TEST-VENDOR"
)
dd = Dictionary("", dictionary)
assert dd["VENDOR-ATTRIBUTE"].code == [10, 20, 10]