Commit 3be8587f authored by Edward Fauchon-Jones's avatar Edward Fauchon-Jones
Browse files

Up field test base class with rewrite methods

The two additional convinience methods facilitate the modification of
fields other than the (now) optional field derived field test classes
represent.
parent 6bdb5b81
......@@ -204,14 +204,22 @@ class TestField(object):
def setValue(self, value):
"""Set the value of the represented field"""
nr = h5.File(self.f.name)
nr.attrs[self.name] = value
nr.close()
self.setNamedField(self.name, value)
def setOutput(self, output):
"""Set the output line of `lvcnrcheck` for the represented field"""
self.setNamedOutput(self.name, output)
def setNamedField(self, name, value):
"""Set the value of the named field"""
nr = h5.File(self.f.name)
nr.attrs[name] = value
nr.close()
def setNamedOutput(self, name, output):
"""Set the output line of `lvcnrcheck` for the named field"""
self.output = re.sub(
r'^- \[=\] {0:s} .*?$'.format(self.name),
r'^- \[=\] {0:s} .*?$'.format(name),
output, self.output, flags=re.MULTILINE)
......
Markdown is supported
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