5 Unit tests for the mavparm library 8 from __future__
import print_function
12 from pymavlink
import mavparm
17 Class to test MAVParmDict 21 """Constructor, set up some data that is reused in many tests""" 22 self.
parms = mavparm.MAVParmDict()
23 self.
parms[
'AFS_ACTION'] = 42
24 self.
parms[
'PARAM1'] = 34.45
25 self.
parms[
'PARAM2'] = 0
26 self.
parms[
'PARAM3'] = -13.4
27 super(MAVParmDictTest, self).
__init__(*args, **kwargs)
31 """Test simple dict operations""" 32 self.
parms[
'AFS_ACTION'] = 34
34 assert self.
parms[
'AFS_ACTION'] == 34
35 assert self.
parms[
'PARAM1'] == 34.45
38 """Test the saving and loading to file""" 39 self.parms.save(
'prms.txt')
40 assert os.path.isfile(
'prms.txt')
42 newparms = mavparm.MAVParmDict()
43 newparms.load(
'prms.txt')
46 assert newparms[
'AFS_ACTION'] == self.
parms[
'AFS_ACTION']
47 assert newparms[
'PARAM3'] == self.
parms[
'PARAM3']
52 """Test show and diff functions""" 53 self.parms.save(
'prms.txt')
57 self.parms.diff(
'prms.txt')
59 if __name__ ==
'__main__':
def __init__(self, args, kwargs)