nismod / smif

Simulation Modelling Integration Framework
http://www.itrc.org.uk
MIT License
22 stars 6 forks source link

Fix bug 317 #318

Closed willu47 closed 5 years ago

willu47 commented 5 years ago

Fixes bug #317 where tests wrongly passed in numpy.ndarray to methods of Adaptor rather than a DataArray.

Note, call to self.convert(data_in.as_ndarray(), from_spec, to_spec, coefficients) can be simplified to:

self.convert(data_array, to_spec, coefficients) as the data_array now contains to source spec as well as the data.

codecov[bot] commented 5 years ago

Codecov Report

Merging #318 into master will increase coverage by 0.06%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #318      +/-   ##
==========================================
+ Coverage   69.68%   69.75%   +0.06%     
==========================================
  Files          59       59              
  Lines        5034     5045      +11     
  Branches      605      605              
==========================================
+ Hits         3508     3519      +11     
  Misses       1431     1431              
  Partials       95       95
Flag Coverage Δ
#javascript 69.75% <100%> (+0.06%) :arrow_up:
#python 77.74% <100%> (+0.05%) :arrow_up:
Impacted Files Coverage Δ
src/smif/data_layer/store.py 94.75% <100%> (+0.02%) :arrow_up:
src/smif/convert/unit.py 56.25% <100%> (+2.91%) :arrow_up:
src/smif/convert/adaptor.py 89.83% <100%> (+1.36%) :arrow_up:
src/smif/convert/interval.py 98.33% <100%> (ø) :arrow_up:
src/smif/data_layer/data_handle.py 82.6% <100%> (+0.07%) :arrow_up:
src/smif/convert/register.py 82.52% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c7e1287...7213f1c. Read the comment docs.

willu47 commented 5 years ago

Should we plan to add type annotations any time we visit smif code?

I would recommend to do so. Using the type hints actually helped quite a lot in managing the complexity of developing the smif package - also, if using the mypy linter within VSCode you get docstrings in otherwise stranded parts of the codebase (e.g. where an object argument is passed into a module, but not imported in that module).