-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
13 changed files
with
153 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
language: python | ||
python: | ||
- "2.7" | ||
- "3.3" | ||
- "3.4" | ||
- "3.5" | ||
# command to install dependencies | ||
install: | ||
- if [[ $TRAVIS_PYTHON_VERSION == 3* ]]; then pip install -r requirements-py3.txt; else pip install -r requirements-py2.txt; fi | ||
# command to run tests | ||
script: nosetests tests | ||
sudo: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
six>=1.10.0 | ||
nose>=1.3.7 | ||
wheel>=0.24.0 | ||
lxml>=3.6.0 | ||
cssselect>=0.9.1 | ||
tox>=1.3 | ||
Sphinx>=1.2.2 | ||
coverage>=3.7.1 | ||
unittest2>=0.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
six>=1.10.0 | ||
nose>=1.3.7 | ||
wheel>=0.24.0 | ||
lxml>=3.6.0 | ||
cssselect>=0.9.1 | ||
tox>=1.3 | ||
Sphinx>=1.2.2 | ||
coverage>=3.7.1 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env python | ||
|
||
try: | ||
import unittest2 as unittest | ||
except ImportError: | ||
import unittest | ||
|
||
import leather | ||
from tests.utils import XMLTest | ||
|
||
|
||
class TestChart(XMLTest): | ||
def setUp(self): | ||
self.data1 = [ | ||
(0, 3), | ||
(4, 5), | ||
(7, 9), | ||
(8, 4) | ||
] | ||
|
||
self.data2 = [ | ||
(0, 4), | ||
(1, 3), | ||
(2, 5), | ||
(5, 6), | ||
(9, 10) | ||
] | ||
|
||
def test_simple(self): | ||
chart = leather.Chart() | ||
chart.add_dots(self.data1) | ||
|
||
svg = self.render_chart(chart) | ||
|
||
self.assertElementCount(svg, '.series', 1) | ||
self.assertElementCount(svg, '.dots', 1) | ||
self.assertElementCount(svg, 'circle', 4) | ||
|
||
def test_multiple(self): | ||
chart = leather.Chart() | ||
chart.add_dots(self.data1) | ||
chart.add_dots(self.data2) | ||
|
||
svg = self.render_chart(chart) | ||
|
||
self.assertElementCount(svg, '.series', 2) | ||
self.assertElementCount(svg, '.dots', 2) | ||
self.assertElementCount(svg, 'circle', 9) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python | ||
|
||
try: | ||
import unittest2 as unittest | ||
except ImportError: | ||
import unittest | ||
|
||
from lxml import etree | ||
import six | ||
|
||
|
||
class XMLTest(unittest.TestCase): | ||
""" | ||
Unittest case for quickly asserting logic about tables. | ||
""" | ||
def render_chart(self, chart): | ||
""" | ||
Verify the column names in the given table match what is expected. | ||
""" | ||
output = six.StringIO() | ||
chart.to_svg(output) | ||
text = output.getvalue() | ||
|
||
text = text.replace(' xmlns="http://www.w3.org/2000/svg"', '') | ||
|
||
return etree.fromstring(text) | ||
|
||
def assertElementCount(self, svg, selector, count): | ||
series = svg.cssselect(selector) | ||
self.assertEqual(len(series), count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[tox] | ||
envlist = py27,py33,py34,py35,pypy | ||
|
||
[testenv] | ||
deps= | ||
nose>=1.1.2 | ||
six>=1.6.1 | ||
lxml>=3.6.0 | ||
cssselect>=0.9.1 | ||
commands=nosetests tests | ||
|
||
[testenv:py27] | ||
deps= | ||
{[testenv]deps} | ||
|
||
[testenv:py33] | ||
deps= | ||
{[testenv]deps} | ||
|
||
[testenv:py34] | ||
deps= | ||
{[testenv:py33]deps} | ||
|
||
[testenv:py35] | ||
deps= | ||
{[testenv:py33]deps} | ||
|
||
[testenv:pypy] | ||
deps= | ||
{[testenv:py27]deps} | ||
|
||
[flake8] | ||
ignore=E128,E402,E501,F403 | ||
# E128 continuation line under-indented for visual indent | ||
# E402 module level import not at top of file | ||
# E501 line too long (X > 79 characters) | ||
# F403 'from xyz import *' used; unable to detect undefined names |