py-aamva icon indicating copy to clipboard operation
py-aamva copied to clipboard

Quirk in weight constructor

Open afk11 opened this issue 1 year ago • 0 comments

I was testing this library out and tried rebuilding a Weight object from it's components (weightRange, weight, and format)

It looks like this line: https://github.com/rechner/py-aamva/blob/master/aamva/aamva.py#L1647 is incorrect and causes the weight field to use an approximated value when the exact weight was provided

Weight(5, 200, 'USA') => instead of weight being 200, it was 205 instead

-if weight_range is None:
+if weight is not None:

because when weight is provided, we really don't want the else case triggering, because instead of using the provided weight it calculates weight using the approximation method instead

afk11 avatar Feb 01 '23 15:02 afk11