Skip to content

WIP: Add tests#36

Open
glwagner wants to merge 2 commits intomasterfrom
glw/add-tests
Open

WIP: Add tests#36
glwagner wants to merge 2 commits intomasterfrom
glw/add-tests

Conversation

@glwagner
Copy link
Copy Markdown
Collaborator

@glwagner glwagner commented May 27, 2020

The tests are run by navigating to /test and typing

$ pytest 

I think we need to add pytest to the yml as well. @dburov190 and @agarbuno please advise (or simply commit to this PR).

Resolves #35

@dburov190
Copy link
Copy Markdown
Collaborator

hm, I'm actually not sure about this yml stuff, I've never used it

are these just standard unit tests, or tests in the sense that we test something against data?

@glwagner
Copy link
Copy Markdown
Collaborator Author

glwagner commented May 27, 2020

@dburov190 I suggest we start with simple easy tests (for a start we just want to ensure that the functions described in the README execute without error; the current method of running the examples will not scale).

The tests I've included combines a test for the instantiation of the samplers and transition rate class (implicitly), as well as a test that ensures we can reproduce the results of the random samplers.

Ideally we would also validate the algorithms we are using (for example, the implementation of the Kalman filter). We'll see what we have time for.

def get_rates(rates_name):
return getattr(king_county_transition_rates(population=3, random_seed=1234), rates_name)

transition_rates = king_county_transition_rates(population=3, random_seed=1234)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems outdated now because scenarios don't have king_count_transition_rates anymore

but I like this test and overall idea, could you massage this into a running test? I'd start adding tests then

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this PR has gone stale. I agree this PR should be revived.

A low-effort solution would be to implement a few simple tests for our most high-level objects, since this will implicitly test lower-level functionality.

We can also consider running some of the examples during testing.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd actually strip apart some of the examples into shorter tests, but, one way or another, we must start writing them, there are so many bugs right now that it's actually scary :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Soliciting tests

2 participants