Skip to content
Snippets Groups Projects
Commit 4bc6d0d8 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Add keys, items and values to Header

parent 87451cf8
No related branches found
No related tags found
No related merge requests found
Pipeline #17495 passed with warnings
......@@ -146,3 +146,12 @@ class Header:
def __getitem__(self, key):
return self._data[key]
def keys(self):
return self._data.keys()
def items(self):
return self._data.items()
def values(self):
return self._data.values()
......@@ -123,6 +123,20 @@ class TestHeader(unittest.TestCase):
assert 7 == header["d"]
assert "bar" == header["e+f"]
def test_header_behaves_like_a_dict(self):
head = {
"a": "1 2 3",
"b+c": "4 5 6",
"c": "foo",
"d": "7",
"e+f": "bar",
}
header = Header(head)
self.assertListEqual(list(head.keys()), list(header.keys()))
assert 5 == len(header.values())
assert 5 == len(header.items())
def test_reading_header_from_sample_file(self):
head = OFFLINE_NUMUCC.header
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment