Browse Source

Fix tests corresponding to scaling tweaks

pull/242/head
Florian Mounier 10 years ago
parent
commit
48cad13ed9
  1. 3
      docs/documentation/sparks.rst
  2. 8
      pygal/test/test_config.py
  3. 22
      pygal/test/test_date.py

3
docs/documentation/sparks.rst

@ -36,8 +36,7 @@ With labels:
.. pygal-code:: sparkline
from pygal.style import LightSolarizedStyle
chart = pygal.Line(style=LightSolarizedStyle)
chart = pygal.Line()
chart.add('', [1, 3, 5, 16, 13, 3, 7])
chart.x_labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
chart.render_sparkline(show_x_labels=True, show_y_labels=True)

8
pygal/test/test_config.py

@ -44,7 +44,7 @@ def test_config_behaviours():
assert len(q(".plot .series path")) == 1
assert len(q(".legend")) == 0
assert len(q(".x.axis .guides")) == 3
assert len(q(".y.axis .guides")) == 21
assert len(q(".y.axis .guides")) == 11
assert len(q(".dots")) == 3
assert q(".axis.x text").map(texts) == ['a', 'b', 'c']
@ -175,7 +175,7 @@ def test_logarithmic():
assert len(q(".plot .series path")) == 1
assert len(q(".legend")) == 1
assert len(q(".x.axis .guides")) == 0
assert len(q(".y.axis .guides")) == 51
assert len(q(".y.axis .guides")) == 21
assert len(q(".dots")) == 3
@ -211,7 +211,7 @@ def test_logarithmic_big_scale():
line = Line(logarithmic=True)
line.add('_', [10 ** -10, 10 ** 10, 1])
q = line.render_pyquery()
assert len(q(".y.axis .guides")) == 41
assert len(q(".y.axis .guides")) == 21
def test_value_formatter():
@ -227,7 +227,7 @@ def test_logarithmic_small_scale():
line = Line(logarithmic=True)
line.add('_', [1 + 10 ** 10, 3 + 10 ** 10, 2 + 10 ** 10])
q = line.render_pyquery()
assert len(q(".y.axis .guides")) == 21
assert len(q(".y.axis .guides")) == 11
def test_human_readable():

22
pygal/test/test_date.py

@ -35,17 +35,10 @@ def test_date():
assert list(
map(lambda t: t.split(' ')[0],
q(".axis.x text").map(texts))) == [
'2013-01-03',
'2013-01-08',
'2013-01-12',
'2013-01-17',
'2013-01-21',
'2013-01-26',
'2013-01-31',
'2013-01-24',
'2013-02-04',
'2013-02-09',
'2013-02-14',
'2013-02-18']
'2013-02-16']
def test_time():
@ -84,17 +77,10 @@ def test_datetime():
assert list(
map(lambda t: t.split(' ')[0],
q(".axis.x text").map(texts))) == [
'2013-01-03T09:00:00',
'2013-01-08T00:06:40',
'2013-01-12T15:13:20',
'2013-01-17T06:20:00',
'2013-01-21T21:26:40',
'2013-01-26T12:33:20',
'2013-01-31T03:40:00',
'2013-01-24T05:00:00',
'2013-02-04T18:46:40',
'2013-02-09T09:53:20',
'2013-02-14T01:00:00',
'2013-02-18T16:06:40']
'2013-02-16T08:33:20']
def test_timedelta():

Loading…
Cancel
Save