summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEmile Anclin <emile.anclin@logilab.fr>2010-11-15 11:56:32 +0100
committerEmile Anclin <emile.anclin@logilab.fr>2010-11-15 11:56:32 +0100
commit2575a944af5839cf1bbafbdfe7f7f55478020014 (patch)
tree69d3e962e42ca99acd40b370028a7365e8a4e999 /test
parent9dda4d681ecb3a769b39223ca723f98157071335 (diff)
downloadlogilab-common-2575a944af5839cf1bbafbdfe7f7f55478020014.tar.gz
2to3: fix a lot of white space after comma
Diffstat (limited to 'test')
-rw-r--r--test/unittest_cache.py4
-rw-r--r--test/unittest_compat.py28
-rw-r--r--test/unittest_configuration.py6
-rw-r--r--test/unittest_date.py20
-rw-r--r--test/unittest_fileutils.py2
-rw-r--r--test/unittest_modutils.py10
-rw-r--r--test/unittest_pytest.py8
-rw-r--r--test/unittest_shellutils.py38
-rw-r--r--test/unittest_table.py86
-rw-r--r--test/unittest_testlib.py18
-rw-r--r--test/unittest_textutils.py12
-rw-r--r--test/unittest_tree.py20
-rw-r--r--test/utils.py2
13 files changed, 127 insertions, 127 deletions
diff --git a/test/unittest_cache.py b/test/unittest_cache.py
index c5dddcf..3e4b185 100644
--- a/test/unittest_cache.py
+++ b/test/unittest_cache.py
@@ -95,8 +95,8 @@ class CacheTestCase(TestCase):
"""
self.cache['foo'] = 'bar'
del self.cache['foo']
- self.assert_('foo' not in self.cache.keys(),"Element 'foo' was not removed cache dictionnary")
- self.assert_('foo' not in self.cache._usage,"Element 'foo' was not removed usage list")
+ self.assert_('foo' not in self.cache.keys(), "Element 'foo' was not removed cache dictionnary")
+ self.assert_('foo' not in self.cache._usage, "Element 'foo' was not removed usage list")
self.assertItemsEqual(self.cache._usage,
self.cache.keys())# usage list and data keys are different
diff --git a/test/unittest_compat.py b/test/unittest_compat.py
index 90b8994..9993f1d 100644
--- a/test/unittest_compat.py
+++ b/test/unittest_compat.py
@@ -84,7 +84,7 @@ class CompatTCMixIn:
class Py23CompatTC(CompatTCMixIn, TestCase):
MODNAMES = {
- 'sets' : ('Set', 'ImmutableSet'),
+ 'sets': ('Set', 'ImmutableSet'),
}
def test_basic_set(self):
@@ -209,21 +209,21 @@ class Py25CompatTC(CompatTCMixIn, TestCase):
from logilab.common.compat import max
# old apy
- self.assertEqual(max("fdjkmhsgmdfhsg"),'s')
- self.assertEqual(max(1,43,12,45,1337,34,2), 1337)
- self.assertRaises(TypeError,max)
- self.assertRaises(TypeError,max,1)
- self.assertRaises(ValueError,max,[])
- self.assertRaises(TypeError,max,bob=None)
+ self.assertEqual(max("fdjkmhsgmdfhsg"), 's')
+ self.assertEqual(max(1, 43, 12, 45, 1337, 34, 2), 1337)
+ self.assertRaises(TypeError, max)
+ self.assertRaises(TypeError, max, 1)
+ self.assertRaises(ValueError, max, [])
+ self.assertRaises(TypeError, max, bob=None)
# new apy
- self.assertEqual(max("shorter","longer",key=len),"shorter")
- self.assertEqual(max(((1,1),(2,3,5),(8,13,21)),key=len),(2,3,5))
- self.assertEqual(max(((1,1),(42,),(2,3,5),(8,13,21)),key=max),(42,))
- self.assertRaises(TypeError,max,key=None)
- self.assertRaises(TypeError,max,1,key=len)
- self.assertRaises(ValueError,max,[],key=max)
- self.assertRaises(TypeError,max,"shorter","longer",key=len,kathy=None)
+ self.assertEqual(max("shorter", "longer", key=len), "shorter")
+ self.assertEqual(max(((1, 1), (2, 3, 5), (8, 13, 21)), key=len), (2, 3, 5))
+ self.assertEqual(max(((1, 1), (42,), (2, 3, 5), (8, 13, 21)), key=max), (42,))
+ self.assertRaises(TypeError, max, key=None)
+ self.assertRaises(TypeError, max, 1, key=len)
+ self.assertRaises(ValueError, max, [], key=max)
+ self.assertRaises(TypeError, max, "shorter", "longer", key=len, kathy=None)
if __name__ == '__main__':
diff --git a/test/unittest_configuration.py b/test/unittest_configuration.py
index 11e9f33..689a067 100644
--- a/test/unittest_configuration.py
+++ b/test/unittest_configuration.py
@@ -31,7 +31,7 @@ DATA = join(dirname(abspath(__file__)), 'data')
options = [('dothis', {'type':'yn', 'action': 'store', 'default': True, 'metavar': '<y or n>'}),
('value', {'type': 'string', 'metavar': '<string>', 'short': 'v'}),
- ('multiple', {'type': 'csv', 'default': ('yop','yep'),
+ ('multiple', {'type': 'csv', 'default': ('yop', 'yep'),
'metavar': '<comma separated values>',
'help': 'you can also document the option'}),
('number', {'type': 'int', 'default':2, 'metavar':'<int>', 'help': 'boom'}),
@@ -62,7 +62,7 @@ class ConfigurationTC(TestCase):
cfg = self.cfg
self.assertEqual(cfg['dothis'], True)
self.assertEqual(cfg['value'], None)
- self.assertEqual(cfg['multiple'], ('yop','yep'))
+ self.assertEqual(cfg['multiple'], ('yop', 'yep'))
self.assertEqual(cfg['number'], 2)
self.assertEqual(cfg['choice'], 'yo')
self.assertEqual(cfg['multiple-choice'], ('yo', 'ye'))
@@ -142,7 +142,7 @@ diffgroup=zou
self.cfg.load_file_configuration(file)
self.assertEqual(self.cfg['dothis'], False)
self.assertEqual(self.cfg['value'], None)
- self.assertEqual(self.cfg['multiple'], ['yop','yepii'])
+ self.assertEqual(self.cfg['multiple'], ['yop', 'yepii'])
self.assertEqual(self.cfg['diffgroup'], 'zou')
finally:
os.remove(file)
diff --git a/test/unittest_date.py b/test/unittest_date.py
index a37abfd..701a473 100644
--- a/test/unittest_date.py
+++ b/test/unittest_date.py
@@ -40,14 +40,14 @@ class DateTC(TestCase):
def test_day(self):
"""enumerate days"""
- r = list(date_range(self.datecls(2000,1,1), self.datecls(2000,1,4)))
- expected = [self.datecls(2000,1,1), self.datecls(2000,1,2), self.datecls(2000,1,3)]
+ r = list(date_range(self.datecls(2000, 1, 1), self.datecls(2000, 1, 4)))
+ expected = [self.datecls(2000, 1, 1), self.datecls(2000, 1, 2), self.datecls(2000, 1, 3)]
self.assertListEqual(r, expected)
- r = list(date_range(self.datecls(2000,1,31), self.datecls(2000,2,3)))
- expected = [self.datecls(2000,1,31), self.datecls(2000,2,1), self.datecls(2000,2,2)]
+ r = list(date_range(self.datecls(2000, 1, 31), self.datecls(2000, 2, 3)))
+ expected = [self.datecls(2000, 1, 31), self.datecls(2000, 2, 1), self.datecls(2000, 2, 2)]
self.assertListEqual(r, expected)
- r = list(date_range(self.datecls(2000,1,1), self.datecls(2000,1,6), 2))
- expected = [self.datecls(2000,1,1), self.datecls(2000,1,3), self.datecls(2000,1,5)]
+ r = list(date_range(self.datecls(2000, 1, 1), self.datecls(2000, 1, 6), 2))
+ expected = [self.datecls(2000, 1, 1), self.datecls(2000, 1, 3), self.datecls(2000, 1, 5)]
self.assertListEqual(r, expected)
def test_add_days_worked(self):
@@ -147,11 +147,11 @@ class MxDateTC(DateTC):
def test_month(self):
"""enumerate months"""
- r = list(date_range(self.datecls(2000,1,2), self.datecls(2000,4,4), endOfMonth))
- expected = [self.datecls(2000,1,2), self.datecls(2000,2,29), self.datecls(2000,3,31)]
+ r = list(date_range(self.datecls(2000, 1, 2), self.datecls(2000, 4, 4), endOfMonth))
+ expected = [self.datecls(2000, 1, 2), self.datecls(2000, 2, 29), self.datecls(2000, 3, 31)]
self.assertListEqual(r, expected)
- r = list(date_range(self.datecls(2000,11,30), self.datecls(2001,2,3), endOfMonth))
- expected = [self.datecls(2000,11,30), self.datecls(2000,12,31), self.datecls(2001,1,31)]
+ r = list(date_range(self.datecls(2000, 11, 30), self.datecls(2001, 2, 3), endOfMonth))
+ expected = [self.datecls(2000, 11, 30), self.datecls(2000, 12, 31), self.datecls(2001, 1, 31)]
self.assertListEqual(r, expected)
if __name__ == '__main__':
diff --git a/test/unittest_fileutils.py b/test/unittest_fileutils.py
index b76196f..7730e22 100644
--- a/test/unittest_fileutils.py
+++ b/test/unittest_fileutils.py
@@ -26,7 +26,7 @@ from logilab.common.testlib import TestCase, unittest_main, unittest
from logilab.common.fileutils import *
DATA_DIR = join(os.path.abspath(os.path.dirname(__file__)), 'data')
-NEWLINES_TXT = join(DATA_DIR,'newlines.txt')
+NEWLINES_TXT = join(DATA_DIR, 'newlines.txt')
class FirstleveldirectoryTC(TestCase):
diff --git a/test/unittest_modutils.py b/test/unittest_modutils.py
index 92e3d04..42cd7d5 100644
--- a/test/unittest_modutils.py
+++ b/test/unittest_modutils.py
@@ -39,7 +39,7 @@ DATADIR = path.join(path.dirname(__file__), 'data')
class TestCase(TLTestCase):
def setUp(self):
- super(TestCase,self).setUp()
+ super(TestCase, self).setUp()
self.__common_in_path = common.__path__[0] in sys.path
if self.__common_in_path:
sys.path.remove(common.__path__[0])
@@ -47,7 +47,7 @@ class TestCase(TLTestCase):
def tearDown(self):
if self.__common_in_path:
sys.path.insert(0, common.__path__[0])
- super(TestCase,self).tearDown()
+ super(TestCase, self).tearDown()
class _module_file_tc(TestCase):
def test_find_zipped_module(self):
@@ -155,7 +155,7 @@ class get_source_file_tc(TestCase):
path.__file__.replace('.pyc', '.py'))
def test_raise(self):
- self.assertRaises(modutils.NoSourceFile, modutils.get_source_file,'whatever')
+ self.assertRaises(modutils.NoSourceFile, modutils.get_source_file, 'whatever')
class is_standard_module_tc(TestCase):
"""
@@ -230,7 +230,7 @@ class get_modules_files_tc(TestCase):
in subdirectories
"""
import data
- modules = modutils.get_module_files(path.join(DATADIR,'find_test'), data.__path__[0])
+ modules = modutils.get_module_files(path.join(DATADIR, 'find_test'), data.__path__[0])
modules.sort()
self.assertEqual(modules,
[path.join(DATADIR, 'find_test', x) for x in ['__init__.py', 'module.py', 'module2.py', 'noendingnewline.py', 'nonregr.py']])
@@ -240,7 +240,7 @@ class get_modules_files_tc(TestCase):
import logilab
del logilab.common.fileutils
del sys.modules['logilab.common.fileutils']
- m = modutils.load_module_from_modpath(['logilab','common', 'fileutils'])
+ m = modutils.load_module_from_modpath(['logilab', 'common', 'fileutils'])
self.assert_( hasattr(logilab, 'common') )
self.assert_( hasattr(logilab.common, 'fileutils') )
self.assert_( m is logilab.common.fileutils )
diff --git a/test/unittest_pytest.py b/test/unittest_pytest.py
index 56fab55..fc5fbca 100644
--- a/test/unittest_pytest.py
+++ b/test/unittest_pytest.py
@@ -31,8 +31,8 @@ class ModuleFunctionTC(TestCase):
self.assertFalse(this_is_a_testdir("this_is_not_a_dir_test"))
self.assertFalse(this_is_a_testdir("this_is_not_a_testdir"))
self.assertFalse(this_is_a_testdir("unittestsarenothere"))
- self.assertTrue(this_is_a_testdir(join("coincoin","unittests")))
- self.assertFalse(this_is_a_testdir(join("unittests","spongebob")))
+ self.assertTrue(this_is_a_testdir(join("coincoin", "unittests")))
+ self.assertFalse(this_is_a_testdir(join("unittests", "spongebob")))
def test_this_is_testfile(self):
self.assertTrue(this_is_a_testfile("test.py"))
@@ -43,8 +43,8 @@ class ModuleFunctionTC(TestCase):
self.assertFalse(this_is_a_testfile("zephir_test.py"))
self.assertFalse(this_is_a_testfile("smoketest.pl"))
self.assertFalse(this_is_a_testfile("unittest"))
- self.assertTrue(this_is_a_testfile(join("coincoin","unittest_bibi.py")))
- self.assertFalse(this_is_a_testfile(join("unittest","spongebob.py")))
+ self.assertTrue(this_is_a_testfile(join("coincoin", "unittest_bibi.py")))
+ self.assertFalse(this_is_a_testfile(join("unittest", "spongebob.py")))
if __name__ == '__main__':
unittest_main()
diff --git a/test/unittest_shellutils.py b/test/unittest_shellutils.py
index 10a51c0..56314be 100644
--- a/test/unittest_shellutils.py
+++ b/test/unittest_shellutils.py
@@ -78,7 +78,7 @@ class ProgressBarTC(TestCase):
def test_refresh(self):
pgb_stream = StringIO()
expected_stream = StringIO()
- pgb = ProgressBar(20,stream=pgb_stream)
+ pgb = ProgressBar(20, stream=pgb_stream)
self.assertEqual(pgb_stream.getvalue(), expected_stream.getvalue()) # nothing print before refresh
pgb.refresh()
expected_stream.write("\r["+' '*20+"]")
@@ -87,7 +87,7 @@ class ProgressBarTC(TestCase):
def test_refresh_g_size(self):
pgb_stream = StringIO()
expected_stream = StringIO()
- pgb = ProgressBar(20,35,stream=pgb_stream)
+ pgb = ProgressBar(20, 35, stream=pgb_stream)
pgb.refresh()
expected_stream.write("\r["+' '*35+"]")
self.assertEqual(pgb_stream.getvalue(), expected_stream.getvalue())
@@ -95,7 +95,7 @@ class ProgressBarTC(TestCase):
def test_refresh_l_size(self):
pgb_stream = StringIO()
expected_stream = StringIO()
- pgb = ProgressBar(20,3,stream=pgb_stream)
+ pgb = ProgressBar(20, 3, stream=pgb_stream)
pgb.refresh()
expected_stream.write("\r["+' '*3+"]")
self.assertEqual(pgb_stream.getvalue(), expected_stream.getvalue())
@@ -121,25 +121,25 @@ class ProgressBarTC(TestCase):
self.assertEqual(pgb_stream.getvalue(), expected_stream.getvalue())
def test_default(self):
- self._update_test(20, xrange(1,21))
+ self._update_test(20, xrange(1, 21))
def test_nbops_gt_size(self):
"""Test the progress bar for nbops > size"""
def half(total):
- for counter in range(1,total+1):
+ for counter in range(1, total+1):
yield counter // 2
self._update_test(40, half(40))
def test_nbops_lt_size(self):
"""Test the progress bar for nbops < size"""
def double(total):
- for counter in range(1,total+1):
+ for counter in range(1, total+1):
yield counter * 2
self._update_test(10, double(10))
def test_nbops_nomul_size(self):
"""Test the progress bar for size % nbops !=0 (non int number of dots per update)"""
- self._update_test(3, (6,13,20))
+ self._update_test(3, (6, 13, 20))
def test_overflow(self):
self._update_test(5, (8, 16, 25, 33, 42, (42, True)), size=42)
@@ -195,43 +195,43 @@ class RawInputTC(TestCase):
def test_ask_default(self):
self.input_answer = ''
- answer = self.qa.ask('text', ('yes','no'), 'yes')
+ answer = self.qa.ask('text', ('yes', 'no'), 'yes')
self.assertEqual(answer, 'yes')
self.input_answer = ' '
- answer = self.qa.ask('text', ('yes','no'), 'yes')
+ answer = self.qa.ask('text', ('yes', 'no'), 'yes')
self.assertEqual(answer, 'yes')
def test_ask_case(self):
self.input_answer = 'no'
- answer = self.qa.ask('text', ('yes','no'), 'yes')
+ answer = self.qa.ask('text', ('yes', 'no'), 'yes')
self.assertEqual(answer, 'no')
self.input_answer = 'No'
- answer = self.qa.ask('text', ('yes','no'), 'yes')
+ answer = self.qa.ask('text', ('yes', 'no'), 'yes')
self.assertEqual(answer, 'no')
self.input_answer = 'NO'
- answer = self.qa.ask('text', ('yes','no'), 'yes')
+ answer = self.qa.ask('text', ('yes', 'no'), 'yes')
self.assertEqual(answer, 'no')
self.input_answer = 'nO'
- answer = self.qa.ask('text', ('yes','no'), 'yes')
+ answer = self.qa.ask('text', ('yes', 'no'), 'yes')
self.assertEqual(answer, 'no')
self.input_answer = 'YES'
- answer = self.qa.ask('text', ('yes','no'), 'yes')
+ answer = self.qa.ask('text', ('yes', 'no'), 'yes')
self.assertEqual(answer, 'yes')
def test_ask_prompt(self):
self.input_answer = ''
- answer = self.qa.ask('text', ('yes','no'), 'yes')
+ answer = self.qa.ask('text', ('yes', 'no'), 'yes')
self.assertEqual(self.input_args[0], 'text [Y(es)/n(o)]: ')
- answer = self.qa.ask('text', ('y','n'), 'y')
+ answer = self.qa.ask('text', ('y', 'n'), 'y')
self.assertEqual(self.input_args[0], 'text [Y/n]: ')
- answer = self.qa.ask('text', ('n','y'), 'y')
+ answer = self.qa.ask('text', ('n', 'y'), 'y')
self.assertEqual(self.input_args[0], 'text [n/Y]: ')
- answer = self.qa.ask('text', ('yes','no','maybe','1'), 'yes')
+ answer = self.qa.ask('text', ('yes', 'no', 'maybe', '1'), 'yes')
self.assertEqual(self.input_args[0], 'text [Y(es)/n(o)/m(aybe)/1]: ')
def test_ask_ambiguous(self):
self.input_answer = 'y'
- self.assertRaises(Exception, self.qa.ask, 'text', ('yes','yep'), 'yes')
+ self.assertRaises(Exception, self.qa.ask, 'text', ('yes', 'yep'), 'yes')
def test_confirm(self):
self.input_answer = 'y'
diff --git a/test/unittest_table.py b/test/unittest_table.py
index 883686e..0ad6cb9 100644
--- a/test/unittest_table.py
+++ b/test/unittest_table.py
@@ -47,22 +47,22 @@ class TableTC(TestCase):
tab.append_row([1])
self.assertEqual(tab, [[1]])
tab.append_row([2])
- self.assertEqual(tab[0,0], 1)
- self.assertEqual(tab[1,0], 2)
+ self.assertEqual(tab[0, 0], 1)
+ self.assertEqual(tab[1, 0], 2)
def test_valeur_ligne(self):
tab = Table()
- tab.create_columns(['col1','col2'])
- tab.append_row([1,2])
- self.assertEqual(tab, [[1,2]])
+ tab.create_columns(['col1', 'col2'])
+ tab.append_row([1, 2])
+ self.assertEqual(tab, [[1, 2]])
def test_valeur_colonne(self):
tab = Table()
tab.create_columns(['col1'])
tab.append_row([1])
tab.append_row([2])
- self.assertEqual(tab, [[1],[2]])
- self.assertEqual(tab[:,0], [1,2])
+ self.assertEqual(tab, [[1], [2]])
+ self.assertEqual(tab[:, 0], [1, 2])
def test_indexation(self):
"""we should be able to use [] to access rows"""
@@ -85,9 +85,9 @@ class TableTC(TestCase):
def test_get_cells(self):
self.table.insert_column(1, range(3), 'supp')
- self.assertEqual(self.table[0,1], 0)
- self.assertEqual(self.table[1,1], 1)
- self.assertEqual(self.table[2,1], 2)
+ self.assertEqual(self.table[0, 1], 0)
+ self.assertEqual(self.table[1, 1], 1)
+ self.assertEqual(self.table[2, 1], 2)
self.assertEqual(self.table['row1', 'supp'], 0)
self.assertEqual(self.table['row2', 'supp'], 1)
self.assertEqual(self.table['row3', 'supp'], 2)
@@ -104,29 +104,29 @@ class TableTC(TestCase):
"""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)
+ 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.
"""
self.table.set_column_by_id('col1', range(3))
- self.assertEqual(self.table[0,0], 0)
- self.assertEqual(self.table[1,0], 1)
- self.assertEqual(self.table[2,0], 2)
+ self.assertEqual(self.table[0, 0], 0)
+ self.assertEqual(self.table[1, 0], 1)
+ self.assertEqual(self.table[2, 0], 2)
self.assertRaises(KeyError, self.table.set_column_by_id, 'col123', range(3))
def test_cells_ids(self):
"""tests that we can access cells by giving row/col ids"""
self.assertRaises(KeyError, self.table.set_cell_by_ids, 'row12', 'col1', 12)
self.assertRaises(KeyError, self.table.set_cell_by_ids, 'row1', 'col12', 12)
- self.assertEqual(self.table[0,0], 0)
+ self.assertEqual(self.table[0, 0], 0)
self.table.set_cell_by_ids('row1', 'col1', 'DATA')
- self.assertEqual(self.table[0,0], 'DATA')
+ self.assertEqual(self.table[0, 0], 'DATA')
self.assertRaises(KeyError, self.table.set_row_by_id, 'row12', [])
self.table.set_row_by_id('row1', ['1.0', '1.1'])
- self.assertEqual(self.table[0,0], '1.0')
+ self.assertEqual(self.table[0, 0], '1.0')
def test_insert_row(self):
"""tests a row insertion"""
@@ -144,21 +144,21 @@ class TableTC(TestCase):
"""
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])
+ 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.
"""
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]])
+ self.assertEqual(self.table.get_columns(), [[0, 0, 0], [12, 0, 13]])
def test_insert_column(self):
"""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[:, 1], [0, 1, 2])
self.assertEqual(self.table.col_names,
['col1', 'inserted_column', 'col2'])
@@ -167,7 +167,7 @@ class TableTC(TestCase):
"""
self.table.delete_column(1)
self.assertEqual(self.table.col_names, ['col1'])
- self.assertEqual(self.table[:,0], [0,0,0])
+ self.assertEqual(self.table[:, 0], [0, 0, 0])
self.assertRaises(KeyError, self.table.delete_column_by_id, 'col2')
self.table.delete_column_by_id('col1')
self.assertEqual(self.table.col_names, [])
@@ -175,11 +175,11 @@ class TableTC(TestCase):
def test_transpose(self):
"""Tests that table.transpose() works fine.
"""
- self.table.append_column(range(5,8), 'col3')
+ self.table.append_column(range(5, 8), 'col3')
ttable = self.table.transpose()
self.assertEqual(ttable.row_names, ['col1', 'col2', 'col3'])
self.assertEqual(ttable.col_names, ['row1', 'row2', 'row3'])
- self.assertEqual(ttable.data, [[0,0,0], [0,0,0], [5,6,7]])
+ self.assertEqual(ttable.data, [[0, 0, 0], [0, 0, 0], [5, 6, 7]])
def test_sort_table(self):
"""Tests the table sort by column
@@ -273,7 +273,7 @@ class TableStyleSheetTC(TestCase):
"""
self.table = Table()
self.table.create_row('row1')
- self.table.create_columns(['a','b','c'])
+ self.table.create_columns(['a', 'b', 'c'])
self.stylesheet = TableStyleSheet()
# We don't want anything to be printed
self.stdout_backup = sys.stdout
@@ -287,9 +287,9 @@ class TableStyleSheetTC(TestCase):
"""
rule = '0_2 = sqrt(0_0**2 + 0_1**2)'
self.stylesheet.add_rule(rule)
- self.table.set_row(0, [3,4,0])
+ self.table.set_row(0, [3, 4, 0])
self.table.apply_stylesheet(self.stylesheet)
- self.assertEqual(self.table[0], [3,4,5])
+ self.assertEqual(self.table[0], [3, 4, 5])
self.assertEqual(len(self.stylesheet.rules), 1)
self.stylesheet.add_rule('some bad rule with bad syntax')
self.assertEqual(len(self.stylesheet.rules), 1, "Ill-formed rule mustn't be added")
@@ -305,44 +305,44 @@ class TableStyleSheetTC(TestCase):
def test_rowavg_rule(self):
"""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.set_row(0, [10, 20, 0])
+ self.stylesheet.add_rowavg_rule((0, 2), 0, 0, 1)
self.table.apply_stylesheet(self.stylesheet)
- val = self.table[0,2]
+ val = self.table[0, 2]
self.assert_(int(val) == 15)
def test_rowsum_rule(self):
"""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.set_row(0, [10, 20, 0])
+ self.stylesheet.add_rowsum_rule((0, 2), 0, 0, 1)
self.table.apply_stylesheet(self.stylesheet)
- val = self.table[0,2]
+ val = self.table[0, 2]
self.assert_(val == 30)
def test_colavg_rule(self):
"""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.set_row(0, [10, 20, 0])
+ self.table.append_row([12, 8, 3], 'row2')
self.table.create_row('row3')
- self.stylesheet.add_colavg_rule((2,0), 0, 0, 1)
+ self.stylesheet.add_colavg_rule((2, 0), 0, 0, 1)
self.table.apply_stylesheet(self.stylesheet)
- val = self.table[2,0]
+ val = self.table[2, 0]
self.assert_(int(val) == 11)
def test_colsum_rule(self):
"""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.set_row(0, [10, 20, 0])
+ self.table.append_row([12, 8, 3], 'row2')
self.table.create_row('row3')
- self.stylesheet.add_colsum_rule((2,0), 0, 0, 1)
+ self.stylesheet.add_colsum_rule((2, 0), 0, 0, 1)
self.table.apply_stylesheet(self.stylesheet)
- val = self.table[2,0]
+ val = self.table[2, 0]
self.assert_(val == 22)
diff --git a/test/unittest_testlib.py b/test/unittest_testlib.py
index 2bb09a5..c497ae8 100644
--- a/test/unittest_testlib.py
+++ b/test/unittest_testlib.py
@@ -82,7 +82,7 @@ class TestlibTC(TestCase):
capture = True
- def mkdir(self,path):
+ def mkdir(self, path):
if not exists(path):
self._dirs.add(path)
os.mkdir(path)
@@ -199,7 +199,7 @@ class TestlibTC(TestCase):
ed1 = join(dirname(__file__), 'data', 'empty_dir_1')
ed2 = join(dirname(__file__), 'data', 'empty_dir_2')
- for path in (ed1, ed2, join(subdir_differ,'unexpected')):
+ for path in (ed1, ed2, join(subdir_differ, 'unexpected')):
self.mkdir(path)
self.assertDirEquals(ed1, ed2)
@@ -289,13 +289,13 @@ class TestlibTC(TestCase):
def test_is(self):
obj_1 = []
obj_2 = []
- self.assertIs(obj_1,obj_1)
+ self.assertIs(obj_1, obj_1)
self.assertRaises(AssertionError, self.assertIs, obj_1, obj_2)
def test_isnot(self):
obj_1 = []
obj_2 = []
- self.assertIsNot(obj_1,obj_2)
+ self.assertIsNot(obj_1, obj_2)
self.assertRaises(AssertionError, self.assertIsNot, obj_1, obj_1)
def test_none(self):
@@ -743,7 +743,7 @@ class DecoratorTC(TestCase):
tempdir = tempfile.gettempdir()
# assert temp directory is empty
self.assertListEqual(list(os.walk(tempdir)),
- [(tempdir,[],[])])
+ [(tempdir, [], [])])
witness = []
@@ -766,7 +766,7 @@ class DecoratorTC(TestCase):
# assert temp directory is empty
self.assertListEqual(list(os.walk(tempdir)),
- [(tempdir,[],[])])
+ [(tempdir, [], [])])
@with_tempdir
def test_tmp_dir_normal_2(self):
@@ -774,7 +774,7 @@ class DecoratorTC(TestCase):
tempdir = tempfile.gettempdir()
# assert temp directory is empty
self.assertListEqual(list(os.walk(tempfile.tempdir)),
- [(tempfile.tempdir,[],[])])
+ [(tempfile.tempdir, [], [])])
class WitnessException(Exception):
@@ -798,7 +798,7 @@ class DecoratorTC(TestCase):
# assert temp directory is empty
self.assertListEqual(list(os.walk(tempdir)),
- [(tempdir,[],[])])
+ [(tempdir, [], [])])
def setUp(self):
self.pyversion = sys.version_info
@@ -902,7 +902,7 @@ class TagTC(TestCase):
self.assertEqual(bob(2, 3, 7), 35)
self.assertTrue(hasattr(bob, 'tags'))
- self.assertSetEqual(bob.tags, set(['testing','bob']))
+ self.assertSetEqual(bob.tags, set(['testing', 'bob']))
def test_tags_class(self):
diff --git a/test/unittest_textutils.py b/test/unittest_textutils.py
index e4dd966..75b9cbb 100644
--- a/test/unittest_textutils.py
+++ b/test/unittest_textutils.py
@@ -124,9 +124,9 @@ class UnitsTC(TestCase):
def setUp(self):
self.units = {
- 'm':60,
- 'kb':1024,
- 'mb':1024*1024,
+ 'm': 60,
+ 'kb': 1024,
+ 'mb': 1024*1024,
}
def test_empty_base(self):
@@ -141,10 +141,10 @@ class UnitsTC(TestCase):
def test_empty_final(self):
# int('12.4') raise value error
- self.assertRaises(ValueError, tu.apply_units,'12.4', {}, final=int)
+ self.assertRaises(ValueError, tu.apply_units, '12.4', {}, final=int)
def test_empty_inter_final(self):
- result = tu.apply_units('12.4', {}, inter=float,final=int)
+ result = tu.apply_units('12.4', {}, inter=float, final=int)
self.assertEqual(result, 12)
self.assertIsInstance(result, int)
@@ -161,7 +161,7 @@ class UnitsTC(TestCase):
self.assertEqual(result, 4298.42)
def test_blank_mixed(self):
- result = tu.apply_units('45, 317, 337', {},final=int)
+ result = tu.apply_units('45, 317, 337', {}, final=int)
self.assertEqual(result, 45317337)
def test_unit_singleunit_singleletter(self):
diff --git a/test/unittest_tree.py b/test/unittest_tree.py
index 7ac476d..3cfcdd8 100644
--- a/test/unittest_tree.py
+++ b/test/unittest_tree.py
@@ -114,21 +114,21 @@ class Node_ClassTest(TestCase):
return depth of this node in the tree
"""
self.assertEqual(self.o.depth_down(), 4)
- self.assertEqual(self.o.get_child_by_id('child_2_1',True).depth_down(), 1)
+ self.assertEqual(self.o.get_child_by_id('child_2_1', True).depth_down(), 1)
def test_known_values_depth(self):
"""
return depth of this node in the tree
"""
self.assertEqual(self.o.depth(), 0)
- self.assertEqual(self.o.get_child_by_id('child_2_1',True).depth(), 2)
+ self.assertEqual(self.o.get_child_by_id('child_2_1', True).depth(), 2)
def test_known_values_width(self):
"""
return depth of this node in the tree
"""
self.assertEqual(self.o.width(), 3)
- self.assertEqual(self.o.get_child_by_id('child_2_1',True).width(), 1)
+ self.assertEqual(self.o.get_child_by_id('child_2_1', True).width(), 1)
def test_known_values_root(self):
"""
@@ -140,15 +140,15 @@ class Node_ClassTest(TestCase):
"""
return a list with all the leaf nodes descendant from this task
"""
- self.assertEqual(self.o.leaves(), [self.o.get_child_by_id('child_2_1',True),
- self.o.get_child_by_id('child_3_1',True),
- self.o.get_child_by_id('child_2_3',True)])
+ self.assertEqual(self.o.leaves(), [self.o.get_child_by_id('child_2_1', True),
+ self.o.get_child_by_id('child_3_1', True),
+ self.o.get_child_by_id('child_2_3', True)])
def test_known_values_lineage(self):
- c31 = self.o.get_child_by_id('child_3_1',True)
- self.assertEqual(c31.lineage(), [self.o.get_child_by_id('child_3_1',True),
- self.o.get_child_by_id('child_2_2',True),
- self.o.get_child_by_id('child_1_1',True),
+ c31 = self.o.get_child_by_id('child_3_1', True)
+ self.assertEqual(c31.lineage(), [self.o.get_child_by_id('child_3_1', True),
+ self.o.get_child_by_id('child_2_2', True),
+ self.o.get_child_by_id('child_1_1', True),
self.o])
diff --git a/test/utils.py b/test/utils.py
index 598d386..73b362b 100644
--- a/test/utils.py
+++ b/test/utils.py
@@ -74,7 +74,7 @@ class WriterTC:
def test_advanced_table(self):
table = Table(cols=2, klass='whatever', id='mytable', rheaders=1)
- for field, value in (('field', 'value') ,('f1', 'v1'), ('f22', 'v22'), ('f333', 'v333')):
+ for field, value in (('field', 'value'), ('f1', 'v1'), ('f22', 'v22'), ('f333', 'v333')):
table.append(Text(field))
table.append(Text(value))
table.append(Link('http://www.perdu.com', 'toi perdu ?'))