Browse Source

Add tests that fails referencing #188

pull/158/merge
Florian Mounier 10 years ago
parent
commit
a1acaacf0e
  1. 7
      demo/moulinrouge/tests.py
  2. 25
      pygal/test/test_graph.py

7
demo/moulinrouge/tests.py

@ -8,6 +8,7 @@ from pygal.style import styles, Style, RotateStyle
from pygal.colors import rotate from pygal.colors import rotate
from pygal.graph.frenchmap import DEPARTMENTS, REGIONS from pygal.graph.frenchmap import DEPARTMENTS, REGIONS
from random import randint, choice from random import randint, choice
from datetime import datetime
def get_test_routes(app): def get_test_routes(app):
@ -218,6 +219,12 @@ def get_test_routes(app):
graph.title = '123456789 ' * 30 graph.title = '123456789 ' * 30
return graph.render_response() return graph.render_response()
@app.route('/test/datey_single')
def test_datey_single():
graph = DateY(interpolate='cubic')
graph.add('Single', [(datetime.now(), 1)])
return graph.render_response()
@app.route('/test/no_data/at_all/<chart>') @app.route('/test/no_data/at_all/<chart>')
def test_no_data_at_all_for(chart): def test_no_data_at_all_for(chart):
graph = CHARTS_BY_NAME[chart]() graph = CHARTS_BY_NAME[chart]()

25
pygal/test/test_graph.py

@ -132,6 +132,31 @@ def test_empty_lists_with_nones(Chart):
q = chart.render_pyquery() q = chart.render_pyquery()
assert len(q(".legend")) == 2 assert len(q(".legend")) == 2
def test_only_one_value(Chart):
chart = Chart()
chart.add('S', [1])
chart.x_labels = ('single')
q = chart.render_pyquery()
assert len(q(".legend")) == 1
def test_only_one_value_log(Chart):
chart = Chart(logarithmic=True)
chart.add('S', [1])
chart.x_labels = ('single')
q = chart.render_pyquery()
assert len(q(".legend")) == 1
def test_only_one_value_intrp(Chart):
chart = Chart(interpolate='cubic')
chart.add('S', [1])
chart.x_labels = ('single')
q = chart.render_pyquery()
assert len(q(".legend")) == 1
def test_non_iterable_value(Chart): def test_non_iterable_value(Chart):
chart = Chart(no_prefix=True) chart = Chart(no_prefix=True)
chart.add('A', 1) chart.add('A', 1)

Loading…
Cancel
Save