Fix: attribute vendor codes retrieval
This commit is contained in:
@@ -377,3 +377,34 @@ def test_invalid_attribute_flags(invalid_flag):
|
||||
dictionary = StringIO(f"ATTRIBUTE NAME 123 octets {invalid_flag}")
|
||||
with pytest.raises(ParseError):
|
||||
Dictionary("", dictionary)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"attribute", ["RFC-ATTRIBUTE", "VENDOR-ATTRIBUTE", 7, (26, 5555, 7)]
|
||||
)
|
||||
def test_get_attributes_from_dictionaries(attribute):
|
||||
dictionary = StringIO(
|
||||
"ATTRIBUTE RFC-ATTRIBUTE 7 integer\n"
|
||||
"VENDOR TEST-VENDOR 5555\n"
|
||||
"BEGIN-VENDOR TEST-VENDOR\n"
|
||||
"ATTRIBUTE VENDOR-ATTRIBUTE 7 integer\n"
|
||||
"END-VENDOR TEST-VENDOR"
|
||||
)
|
||||
dd = Dictionary("", dictionary)
|
||||
_ = dd[attribute]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"attribute", ["RFC-ATTRIBUTE1", 8, (26, 5556, 7), (26, 5555, 8)]
|
||||
)
|
||||
def test_get_nonexisting_attributes_from_dictionaries(attribute):
|
||||
dictionary = StringIO(
|
||||
"ATTRIBUTE RFC-ATTRIBUTE 7 integer\n"
|
||||
"VENDOR TEST-VENDOR 5555\n"
|
||||
"BEGIN-VENDOR TEST-VENDOR\n"
|
||||
"ATTRIBUTE VENDOR-ATTRIBUTE 7 integer\n"
|
||||
"END-VENDOR TEST-VENDOR"
|
||||
)
|
||||
dd = Dictionary("", dictionary)
|
||||
with pytest.raises(KeyError):
|
||||
_ = dd[attribute]
|
||||
|
||||
Reference in New Issue
Block a user