IAMconsortium / pyam

Analysis & visualization of energy & climate scenarios
https://pyam-iamc.readthedocs.io/
Apache License 2.0
226 stars 118 forks source link

Add unit tests for using binary ops with numerical args #537

Closed danielhuppmann closed 3 years ago

danielhuppmann commented 3 years ago

Please confirm that this PR has done the following:

Description of PR

PR #533 implicitly generalized the binary-operation methods to enable using numbers as arguments. This PR adds unit tests to make sure this continues to work as expected, updates the docstrings, and adds a sanity check if a user would do something like df.add(2, 3, "foo"), where the return-object cannot be cast to an IamDataFrame.

closes #530

danielhuppmann commented 3 years ago

pinging @pjuergens for a review

codecov[bot] commented 3 years ago

Codecov Report

Merging #537 (7fd55c6) into main (3684c24) will increase coverage by 0.0%. The diff coverage is 92.3%.

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #537   +/-   ##
=====================================
  Coverage   93.4%   93.5%           
=====================================
  Files         47      47           
  Lines       5123    5129    +6     
=====================================
+ Hits        4789    4796    +7     
+ Misses       334     333    -1     
Impacted Files Coverage Δ
pyam/utils.py 92.2% <25.0%> (+0.2%) :arrow_up:
pyam/_ops.py 100.0% <100.0%> (ø)
pyam/core.py 92.6% <100.0%> (ø)
tests/test_feature_compare.py 100.0% <100.0%> (ø)
tests/test_ops.py 100.0% <100.0%> (ø)

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 3684c24...7fd55c6. Read the comment docs.

danielhuppmann commented 3 years ago

Merging without review (because this PR is mainly adding tests)