def test_save_single_rarefaction_plots(self):
        '''save_single_rarefaction_plots: this generates a plot with raw
           rarefaction data on a plot and tests whether a file is generated'''

        filename1 = '/tmp/testcol_0_row_0_raw.png'
        self._paths_to_clean_up = [filename1]

        exp = {
            'test': {'groups': {'SampleID': {'Sample1': {'groupcolor': '#ff0000',
                                                         'raw_link':
                                                         'html_plots/testcol_0_row_0_raw.png',
                                                         'groupsamples': ['Sample1']}}},
                     'samples': {'Sample1': {'color': '#ff0000',
                                             'link': 'html_plots/testcol_0_row_0.png'}}}}

        obs = save_single_rarefaction_plots(self.sample_dict,
                                            self.imagetype, self.metric_name,
                                            self.data_colors, self.colors, '/tmp/',
                                            self.background_color, self.label_color, self.resolution,
                                            self.ymax, self.xmax,
                                            self.rarefaction_legend_mat, self.groups,
                                            self.mapping_category, 'Sample1', self.mapping_lookup)

        self.assertEqual(obs, exp)
        self.assertTrue(exists(filename1))
Exemple #2
0
    def test_save_single_rarefaction_plots(self):
        '''save_single_rarefaction_plots: this generates a plot with raw
           rarefaction data on a plot and tests whether a file is generated'''

        filename1 = '/tmp/testcol_0_row_0_raw.png'
        self._paths_to_clean_up = [filename1]

        exp = {
            'test': {'groups': {'SampleID': {'Sample1': {'groupcolor': '#ff0000',
                                                         'raw_link':
                                                         'html_plots/testcol_0_row_0_raw.png',
                                                         'groupsamples': ['Sample1']}}},
                     'samples': {'Sample1': {'color': '#ff0000',
                                             'link': 'html_plots/testcol_0_row_0.png'}}}}

        obs = save_single_rarefaction_plots(self.sample_dict,
                                            self.imagetype, self.metric_name,
                                            self.data_colors, self.colors, '/tmp/',
                                            self.background_color, self.label_color, self.resolution,
                                            self.ymax, self.xmax,
                                            self.rarefaction_legend_mat, self.groups,
                                            self.mapping_category, 'Sample1', self.mapping_lookup)

        self.assertEqual(obs, exp)
        self.assertTrue(exists(filename1))
    def test_save_single_rarefaction_plots(self):
        """save_single_rarefaction_plots: this generates a plot with raw
           rarefaction data on a plot and tests whether a file is generated"""

        filename1 = "/tmp/testcol_0_row_0_raw.png"
        self._paths_to_clean_up = [filename1]

        exp = {
            "test": {
                "groups": {
                    "SampleID": {
                        "Sample1": {
                            "groupcolor": "#ff0000",
                            "raw_link": "html_plots/testcol_0_row_0_raw.png",
                            "groupsamples": ["Sample1"],
                        }
                    }
                },
                "samples": {"Sample1": {"color": "#ff0000", "link": "html_plots/testcol_0_row_0.png"}},
            }
        }

        obs = save_single_rarefaction_plots(
            self.sample_dict,
            self.imagetype,
            self.metric_name,
            self.data_colors,
            self.colors,
            "/tmp/",
            self.background_color,
            self.label_color,
            self.resolution,
            self.ymax,
            self.xmax,
            self.rarefaction_legend_mat,
            self.groups,
            self.mapping_category,
            "Sample1",
            self.mapping_lookup,
        )

        self.assertEqual(obs, exp)
        self.assertTrue(exists(filename1))