summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_cache.py6
-rw-r--r--test/test_configuration.py4
-rw-r--r--test/test_table.py51
-rw-r--r--test/test_testlib.py15
4 files changed, 29 insertions, 47 deletions
diff --git a/test/test_cache.py b/test/test_cache.py
index d094943..41c628e 100644
--- a/test/test_cache.py
+++ b/test/test_cache.py
@@ -106,8 +106,7 @@ class CacheTestCase(TestCase):
) # usage list and data keys are different
def test_nullsize(self):
- """Checks that a 'NULL' size cache doesn't store anything
- """
+ """Checks that a 'NULL' size cache doesn't store anything"""
null_cache = Cache(0)
null_cache["foo"] = "bar"
self.assertEqual(null_cache.size, 0, "Cache size should be O, not %d" % null_cache.size)
@@ -118,8 +117,7 @@ class CacheTestCase(TestCase):
self.assertRaises(KeyError, null_cache.__delitem__, "foo")
def test_getitem(self):
- """ Checks that getitem doest not modify the _usage attribute
- """
+ """Checks that getitem doest not modify the _usage attribute"""
try:
self.cache["toto"]
except KeyError:
diff --git a/test/test_configuration.py b/test/test_configuration.py
index a4f8ec0..372d787 100644
--- a/test/test_configuration.py
+++ b/test/test_configuration.py
@@ -192,8 +192,8 @@ diffgroup=zou
os.remove(file)
def test_option_order(self):
- """ Check that options are taken into account in the command line order
- and not in the order they are defined in the Configuration object.
+ """Check that options are taken into account in the command line order
+ and not in the order they are defined in the Configuration object.
"""
file = tempfile.mktemp()
stream = open(file, "w")
diff --git a/test/test_table.py b/test/test_table.py
index e3736c1..bf12616 100644
--- a/test/test_table.py
+++ b/test/test_table.py
@@ -106,16 +106,14 @@ class TableTC(TestCase):
self.assertEqual(self.table.shape, (3, 3))
def test_set_column(self):
- """Tests that table.set_column() works fine.
- """
+ """Tests that table.set_column() works fine."""
self.table.set_column(0, range(3))
self.assertEqual(self.table[0, 0], 0)
self.assertEqual(self.table[1, 0], 1)
self.assertEqual(self.table[2, 0], 2)
def test_set_column_by_id(self):
- """Tests that table.set_column_by_id() works fine.
- """
+ """Tests that table.set_column_by_id() works fine."""
self.table.set_column_by_id("col1", range(3))
self.assertEqual(self.table[0, 0], 0)
self.assertEqual(self.table[1, 0], 1)
@@ -145,30 +143,26 @@ class TableTC(TestCase):
self.assertRaises(KeyError, self.table.__getitem__, "tmprow")
def test_get_column(self):
- """Tests that table.get_column() works fine.
- """
+ """Tests that table.get_column() works fine."""
self.table.set_cell(0, 1, 12)
self.table.set_cell(2, 1, 13)
self.assertEqual(self.table[:, 1], [12, 0, 13])
self.assertEqual(self.table[:, "col2"], [12, 0, 13])
def test_get_columns(self):
- """Tests if table.get_columns() works fine.
- """
+ """Tests if table.get_columns() works fine."""
self.table.set_cell(0, 1, 12)
self.table.set_cell(2, 1, 13)
self.assertEqual(self.table.get_columns(), [[0, 0, 0], [12, 0, 13]])
def test_insert_column(self):
- """Tests that table.insert_column() works fine.
- """
+ """Tests that table.insert_column() works fine."""
self.table.insert_column(1, range(3), "inserted_column")
self.assertEqual(self.table[:, 1], [0, 1, 2])
self.assertEqual(self.table.col_names, ["col1", "inserted_column", "col2"])
def test_delete_column(self):
- """Tests that table.delete_column() works fine.
- """
+ """Tests that table.delete_column() works fine."""
self.table.delete_column(1)
self.assertEqual(self.table.col_names, ["col1"])
self.assertEqual(self.table[:, 0], [0, 0, 0])
@@ -177,8 +171,7 @@ class TableTC(TestCase):
self.assertEqual(self.table.col_names, [])
def test_transpose(self):
- """Tests that table.transpose() works fine.
- """
+ """Tests that table.transpose() works fine."""
self.table.append_column(range(5, 8), "col3")
ttable = self.table.transpose()
self.assertEqual(ttable.row_names, ["col1", "col2", "col3"])
@@ -186,8 +179,7 @@ class TableTC(TestCase):
self.assertEqual(ttable.data, [[0, 0, 0], [0, 0, 0], [5, 6, 7]])
def test_sort_table(self):
- """Tests the table sort by column
- """
+ """Tests the table sort by column"""
self.table.set_column(0, [3, 1, 2])
self.table.set_column(1, [1, 2, 3])
self.table.sort_by_column_index(0)
@@ -246,7 +238,11 @@ class GroupByTC(TestCase):
)
self.assertEqual(grouped["date2"], [("date2", "ing3", "task3", 0.3)])
self.assertEqual(
- grouped["date3"], [("date3", "ing4", "task2", 0.3), ("date3", "ing1", "task3", 0.3),]
+ grouped["date3"],
+ [
+ ("date3", "ing4", "task2", 0.3),
+ ("date3", "ing1", "task3", 0.3),
+ ],
)
def test_multiple_groupby(self):
@@ -276,12 +272,10 @@ class GroupByTC(TestCase):
class TableStyleSheetTC(TestCase):
- """The Stylesheet test case
- """
+ """The Stylesheet test case"""
def setUp(self):
- """Builds a simple table to test the stylesheet
- """
+ """Builds a simple table to test the stylesheet"""
self.table = Table()
self.table.create_row("row1")
self.table.create_columns(["a", "b", "c"])
@@ -294,8 +288,7 @@ class TableStyleSheetTC(TestCase):
sys.stdout = self.stdout_backup
def test_add_rule(self):
- """Tests that the regex pattern works as expected.
- """
+ """Tests that the regex pattern works as expected."""
rule = "0_2 = sqrt(0_0**2 + 0_1**2)"
self.stylesheet.add_rule(rule)
self.table.set_row(0, [3, 4, 0])
@@ -314,8 +307,7 @@ class TableStyleSheetTC(TestCase):
self.assertEqual(len(sheet.instructions), 1, "Ill-formed rule mustn't be added")
def test_rowavg_rule(self):
- """Tests that add_rowavg_rule works as expected
- """
+ """Tests that add_rowavg_rule works as expected"""
self.table.set_row(0, [10, 20, 0])
self.stylesheet.add_rowavg_rule((0, 2), 0, 0, 1)
self.table.apply_stylesheet(self.stylesheet)
@@ -323,8 +315,7 @@ class TableStyleSheetTC(TestCase):
self.assertEqual(int(val), 15)
def test_rowsum_rule(self):
- """Tests that add_rowsum_rule works as expected
- """
+ """Tests that add_rowsum_rule works as expected"""
self.table.set_row(0, [10, 20, 0])
self.stylesheet.add_rowsum_rule((0, 2), 0, 0, 1)
self.table.apply_stylesheet(self.stylesheet)
@@ -332,8 +323,7 @@ class TableStyleSheetTC(TestCase):
self.assertEqual(val, 30)
def test_colavg_rule(self):
- """Tests that add_colavg_rule works as expected
- """
+ """Tests that add_colavg_rule works as expected"""
self.table.set_row(0, [10, 20, 0])
self.table.append_row([12, 8, 3], "row2")
self.table.create_row("row3")
@@ -343,8 +333,7 @@ class TableStyleSheetTC(TestCase):
self.assertEqual(int(val), 11)
def test_colsum_rule(self):
- """Tests that add_colsum_rule works as expected
- """
+ """Tests that add_colsum_rule works as expected"""
self.table.set_row(0, [10, 20, 0])
self.table.append_row([12, 8, 3], "row2")
self.table.create_row("row3")
diff --git a/test/test_testlib.py b/test/test_testlib.py
index d2240ae..f906560 100644
--- a/test/test_testlib.py
+++ b/test/test_testlib.py
@@ -724,8 +724,7 @@ class DecoratorTC(TestCase):
sys.version_info = self.pyversion
def test_require_version_good(self):
- """ should return the same function
- """
+ """should return the same function"""
def func():
pass
@@ -744,8 +743,7 @@ class DecoratorTC(TestCase):
)
def test_require_version_bad(self):
- """ should return a different function : skipping test
- """
+ """should return a different function : skipping test"""
def func():
pass
@@ -764,8 +762,7 @@ class DecoratorTC(TestCase):
)
def test_require_version_exception(self):
- """ should throw a ValueError exception
- """
+ """should throw a ValueError exception"""
def func():
pass
@@ -776,8 +773,7 @@ class DecoratorTC(TestCase):
self.assertRaises(ValueError, decorator, func)
def test_require_module_good(self):
- """ should return the same function
- """
+ """should return the same function"""
def func():
pass
@@ -793,8 +789,7 @@ class DecoratorTC(TestCase):
)
def test_require_module_bad(self):
- """ should return a different function : skipping test
- """
+ """should return a different function : skipping test"""
def func():
pass