diff --git a/pygal/formatters.py b/pygal/formatters.py index 458f068..483cb45 100644 --- a/pygal/formatters.py +++ b/pygal/formatters.py @@ -20,6 +20,8 @@ Formatters to use with `value_formatter` and `x_value_formatter` configs """ +from __future__ import division + from datetime import datetime, date, time from math import floor, log from pygal._compat import u, to_str diff --git a/pygal/test/test_config.py b/pygal/test/test_config.py index eabe09a..111719a 100644 --- a/pygal/test/test_config.py +++ b/pygal/test/test_config.py @@ -515,11 +515,11 @@ def test_formatters(Chart): return chart = Chart(formatter=lambda x, chart, serie: '%s%s$' % ( x, serie.title)) - chart.add('_a', [1, 2, {'value': 3, 'formatter': lambda x: '%s¥' % x}]) - chart.add('_b', [4, 5, 6], formatter=lambda x: '%s€' % x) + chart.add('_a', [1, 2, {'value': 3, 'formatter': lambda x: u('%s¥') % x}]) + chart.add('_b', [4, 5, 6], formatter=lambda x: u('%s€') % x) chart.x_labels = [2, 4, 6] chart.x_labels_major = [4] q = chart.render_pyquery() - assert {v.text for v in q(".value")} == set(( - '4€', '5€', '6€', '1_a$', '2_a$', '3¥') + ( - ('6_a$', '15€') if Chart == Pie else ())) + assert set([v.text for v in q(".value")]) == set(( + u('4€'), u('5€'), u('6€'), '1_a$', '2_a$', u('3¥')) + ( + ('6_a$', u('15€')) if Chart == Pie else ())) diff --git a/pygal/test/test_formatters.py b/pygal/test/test_formatters.py index 092f9f9..925480c 100644 --- a/pygal/test/test_formatters.py +++ b/pygal/test/test_formatters.py @@ -58,7 +58,7 @@ def test_human_readable(): def test_human_readable_custom(): """Test human_readable formatter option""" f = formatters.HumanReadable() - assert f(None) == '∅' + assert f(None) == u('∅') f = formatters.HumanReadable(none_char='/') assert f(None) == '/'