Exemplo n.º 1
0
    def test_values_to_colors(self):
        res = values_to_colors(self.feature_data['not_so_important'],
                               color_palette='Dark2')

        # do not check for the exact colors, since these might change
        self.assertEqual(len(res), 2)
        self.assertEqual(set(res.keys()), {'x', 'y'})
Exemplo n.º 2
0
    def test_values_to_colors_repeated(self):
        with self.assertWarns(UserWarning):
            res = values_to_colors(self.feature_data['important'],
                                   color_palette='Dark2')

        # do not check for the exact colors, since these might change
        self.assertEqual(len(res), 10)
        self.assertEqual(set(res.keys()),
                         {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'})
        self.assertEqual(res['a'], res['i'])
        self.assertEqual(res['b'], res['j'])