Skip to content

Commit

Permalink
added test for groovy
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdelgrosso committed Oct 6, 2021
1 parent cfdbb67 commit e425944
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
4 changes: 4 additions & 0 deletions features/all.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ Feature: All Features
And the user has loaded a TSV file exported from QuPath
When the user exports the data to file export.csv
Then the export.csv file is saved on the computer

Scenario: Export Qupath Cell-Registration Groovy Script
When the user requests the QuPath TSV cell export script to file script.groovy
Then the script.groovy file is saved on the computer
20 changes: 16 additions & 4 deletions features/test_all_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,28 @@ def app() -> App:

@scenario('all.feature', 'Loading Data from TSV')
def test_data_shows_up_on_load():
pass
...


@scenario('all.feature', 'Save Merged CSV')
def test_data_is_exported():
pass
...


@scenario('all.feature', 'Filter Cells by single Brain Region')
def test_filter_plot_by_brain_region():
pass
...


@scenario('all.feature', 'Export Brain-Region Filtered Cells')
def test_exported_data_is_filtered_by_brain_region():
pass
...


@scenario('all.feature', 'Export Qupath Cell-Registration Groovy Script')
def test_groovy_file_is_exported():
...

@given("the user has loaded the Allen Mouse Atlas")
def step_impl(app: App):
app.load_atlas_button.click()
Expand Down Expand Up @@ -121,3 +125,11 @@ def step_impl(tmp_path, filename, brain_region):
brain_regions_in_file = df.BrainRegion.unique()
assert len(brain_regions_in_file) == 1
assert brain_regions_in_file[0] == brain_region


@when(
parse("the user requests the QuPath TSV cell export script to file {filename}"),
converters={'filename': Path},
)
def step_impl(app: App, tmp_path, filename: Path):
app.save_groovy_script_button.submit(tmp_path / filename)
4 changes: 2 additions & 2 deletions regexport/actions/save_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class SaveGroovyScriptActionModel:
text = "0. Get QuPath Exporter"

def savedata(self, filename):
def submit(self, filename):
groovy_script = read_text(qupath_scripts, 'export_registered_cells_to_tsv.groovy')
with open(filename, 'w') as f:
f.write(groovy_script)
Expand All @@ -33,4 +33,4 @@ def click(self):
if not filename:
return

self.model.savedata(Path(filename))
self.model.submit(Path(filename))

0 comments on commit e425944

Please sign in to comment.