/usr/lib/python3/dist-packages/leather/testcase.py is in python3-leather 0.3.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #!/usr/bin/env python
try:
import unittest2 as unittest
except ImportError:
import unittest
import six
class LeatherTestCase(unittest.TestCase):
"""
Unittest case for quickly asserting logic about charts.
"""
def render_chart(self, chart):
"""
Verify the column names in the given table match what is expected.
"""
svg = chart.to_svg()
return self.parse_svg(svg)
def parse_svg(self, text):
from lxml import etree
text = text.replace(' xmlns="http://www.w3.org/2000/svg"', '')
if six.PY3:
text = text.encode('utf-8')
return etree.fromstring(text)
def assertElementCount(self, svg, selector, count):
series = svg.cssselect(selector)
self.assertEqual(len(series), count)
def assertTickLabels(self, svg, orient, compare):
ticks = [t.text for t in svg.cssselect('.%s .tick text' % orient)]
self.assertSequenceEqual(ticks, compare)
|