Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase test coverage #20

Merged
merged 8 commits into from
May 15, 2017
Merged

Conversation

simleo
Copy link
Member

@simleo simleo commented May 12, 2017

This PR expands test_readfile and adds test_{createdp,pushtopandas}.

At present, since:

it's hard to build small artificial test cases where the expected behavior can be determined by visual inspection. On the other hand, refactoring / cleaning up the code without adequate test coverage can lead to regression. For this reason, the approach adopted in this PR is to use the current examples as a reference for the expected results, which basically amounts to assuming that the current code (which generated those examples) is correct. Note that I've added tracks.csv files since they were necessary for testing the pushtopandas module. They have been generated with a quick hack:

import os
import csv
from biotracks.pushtopandas import push_to_pandas

dirs = [
    "examples/CellProfiler/example_1/output/dp",
    "examples/CellProfiler/example_2/output/dp",
    "examples/ICY/example_1/dp",
    "examples/ICY/example_2/dp",
    "examples/TrackMate/example_1/dp",
    "examples/TrackMate/example_2/dp",
]

for d in dirs:
    if "TrackMate" in d:
        obj_id = 'SPOT_ID'
    elif "ICY" in d:
        obj_id = 'OBJECT_ID'
    else:
        obj_id = "ObjectID"
    dict_ = push_to_pandas(d, obj_id)
    dict_['tracks'].to_csv(os.path.join(d, 'tracks.csv'), index=False, quoting=csv.QUOTE_NONE)

@simleo simleo requested review from sbesson and pcmasuzzo May 12, 2017 16:38
Copy link
Member

@pcmasuzzo pcmasuzzo left a comment

Choose a reason for hiding this comment

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

This PR is a substantial move forward towards bigger test coverage. +1 in particular for adding test on creation of the datapackage for the three software currently covered. All good to me! Thanks.

@simleo
Copy link
Member Author

simleo commented May 15, 2017

Coming up next: simleo/biotracks@168fb30. It depends on this PR, so I'll wait for this to be merged then rebase and open a new PR.

@sbesson sbesson merged commit 9453a04 into CellMigStandOrg:master May 15, 2017
@simleo simleo deleted the test_coverage branch May 16, 2017 10:08
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.

3 participants