Closed Ircama closed 5 years ago
Can you add a comment describing what is happening? I think it is a little confusing if just reading the code.
I edited the description
Also if possible can we avoid a one line if statement?
OK I'll revise the return
statement.
This is a small enhancement to
__repr__
to produce a working function. Notice anyway that the decoding function is fixed toraw_string
and needsfrom obd.decoders import raw_string
to be tested.Test program:
Output:
Before:
Short description and PID are shown. Header for instance is not displayed. There might be commands with same PID and different headers.
If you test the obtained commands (e.g.,
eval(repr(obd.commands.SPEED))
), they will not work:After:
The two above
OBDCommand
functions can be directly tested:Notice anyway that the existing decoding function is always substituted by the
raw_string
one.Now we will test the obtained functions. The resulting test works:
The produced output is in
raw_string
format at the moment.