def test_from_function_without_inputs_or_parameters(self): visualizer = self.plugin.visualizers['no_input_viz'] self.assertEqual(visualizer.id, 'no_input_viz') exp_sig = VisualizerSignature(no_input_viz, inputs={}, parameters={}) self.assertEqual(visualizer.signature, exp_sig) self.assertEqual(visualizer.name, 'No input viz') self.assertTrue( visualizer.description.startswith('This visualizer does not ' 'accept any')) self.assertTrue( visualizer.source.startswith('\n```python\ndef no_input_viz('))
def test_from_function_without_parameters(self): visualizer = self.plugin.visualizers['most_common_viz'] self.assertEqual(visualizer.id, 'most_common_viz') exp_sig = VisualizerSignature( most_common_viz, inputs={'ints': IntSequence1 | IntSequence2}, parameters={}) self.assertEqual(visualizer.signature, exp_sig) self.assertEqual(visualizer.name, 'Visualize most common integers') self.assertTrue( visualizer.description.startswith('This visualizer produces HTML ' 'and TSV')) self.assertTrue( visualizer.source.startswith('\n```python\ndef most_common_viz('))
def test_from_function_with_parameters_only(self): visualizer = self.plugin.visualizers['params_only_viz'] self.assertEqual(visualizer.id, 'params_only_viz') exp_sig = VisualizerSignature(params_only_viz, inputs={}, parameters={ 'name': qiime2.plugin.Str, 'age': qiime2.plugin.Int }) self.assertEqual(visualizer.signature, exp_sig) self.assertEqual(visualizer.name, 'Parameters only viz') self.assertTrue( visualizer.description.startswith('This visualizer only accepts ' 'parameters.')) self.assertTrue( visualizer.source.startswith('\n```python\ndef params_only_viz('))
def test_from_function_with_artifacts_and_parameters(self): visualizer = self.plugin.visualizers['mapping_viz'] self.assertEqual(visualizer.id, 'mapping_viz') exp_sig = VisualizerSignature( mapping_viz, inputs={ 'mapping1': Mapping, 'mapping2': Mapping }, parameters={ 'key_label': qiime2.plugin.Str, 'value_label': qiime2.plugin.Str }, ) self.assertEqual(visualizer.signature, exp_sig) self.assertEqual(visualizer.name, 'Visualize two mappings') self.assertTrue( visualizer.description.startswith('This visualizer produces an ' 'HTML visualization')) self.assertTrue( visualizer.source.startswith('\n```python\ndef mapping_viz('))