JuliaDynamics / ComplexityMeasures.jl

Estimators for probabilities, entropies, and other complexity measures derived from data in the context of nonlinear dynamics and complex systems
MIT License
56 stars 14 forks source link

increasing coverage for : #320

Closed Jay-sanjay closed 1 year ago

Jay-sanjay commented 1 year ago

increasing coverage for: 1) SpatialOrdinaryPatterns.jl added testcases to test the show method for SpatialOrdinalPatterns For increasing code coverage issue #85 fixing

codecov[bot] commented 1 year ago

Codecov Report

Merging #320 (0e5a9c1) into main (60ad04b) will increase coverage by 0.20%. The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #320      +/-   ##
==========================================
+ Coverage   87.76%   87.96%   +0.20%     
==========================================
  Files          76       76              
  Lines        1920     1920              
==========================================
+ Hits         1685     1689       +4     
+ Misses        235      231       -4     

see 1 file with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

kahaaga commented 1 year ago

Hey, @Jay-sanjay! Please when opening a PR, add a few sentences describing the changes. This makes it easier for the repository maintainers to understand what the contribution is.

What are these changes meant to test? You've added a bunch of println lines, applied to many essentially identical est variables. There's no actual tests added - only printing. Is your intention to test the show method for SpatialOrdinalPatterns? If so, please remove the println statements. Instead, add a test at the top of the file somewhere (with a comment indicating what you're testing). The test must actually test something (i.e. using the @test macro), not only print.

How to write tests for Base.show for custom types in Julia

# It this is the definition and custom show method
struct MyFancyStruct
    myfield
end
Base.show(io::IO, x::MyFancyStruct) = print(io, "Heyo, I'm printing this nicely: $(x.myfield)")

# Then test that the output is actually what we want
using Test
out = repr(MyFancyStruct("flowers")) # capture the output to console as a string
@test occursin("flowers", out)
@test occursin("Heyo, I'm printing this nicely:", out)

Applying this to SpatialOrdinalPatterns, you need to check out how we've defined the custom show method for that type. Then, verify that the output string for an instance of this type, when printed to console, contains at least part of what we've defined the output to be. The repr function gives your the actual text output.

Jay-sanjay commented 1 year ago

@kahaaga Firstly thank you sir for the feedback . I will work on it accordingly . And exactly, I was trying to test the show method for SpatialOrdinalPatterns.jl . I will add the testcases the way you said .