ebmdatalab / outliers

repo for outlier detection work
MIT License
0 stars 0 forks source link

unit test added #1

Closed CarolineMorton closed 4 years ago

CarolineMorton commented 4 years ago

As discussed I have added a unit test for the function get_stats() that Alex is using for the Outlier Projects. This is a trial to see what approach we want. The function requires a certain set up of a multi-index dataframe. I have added two approaches to the test. Both use pure python to calculate mean and standard deviation from a dictionary and compare output from the dataframe. I had to make the dictionary from the original dataframe to make sure it is correct. The dataframe has fake data in it!

The first approach is simple, using return statements. I feel this is more intuitive to people and will make it easier to adopt across the team but it is less correct. It can be run in the notebook by importing test_get_stats() and feeding it the fake dataframe.

The second approach is using unittest and running it from the command line in the normal manner.

Would be great to hear your thoughts!

Thanks

Caroline

CarolineMorton commented 4 years ago

@evansd @sebbacon @inglesp

Please see changes made in response to comments. Makes it a bit easier to work with! Keen to hear comments. I have renamed the files and functions so they should run with pytest...

CarolineMorton commented 4 years ago

thanks Dave, this is very helpful!

   

Sent: Monday, January 13, 2020 at 2:01 PM From: "Dave Evans" notifications@github.com To: ebmdatalab/outliers outliers@noreply.github.com Cc: CarolineMorton carolinemorton@gmx.com, Author author@noreply.github.com Subject: Re: [ebmdatalab/outliers] unit test added (#1)

@evansd approved this pull request.

Looks great. I checked out this branch, installed pytest and ran:

python -m pytest

And it successfully found and ran the test.

Incidentally, I learned through this process that running python -m pytest is subtlety different from running just pytest, which I didn't know before.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.