[geneagrapher] 174/226: Reformatting tests for PEP8 conformance.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sat Jul 11 17:11:03 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository geneagrapher.

commit 9c9cb3377fc8e6954e2189528de6db5982dd3651
Author: David Alber <alber.david at gmail.com>
Date:   Sat Nov 26 11:35:49 2011 -0800

    Reformatting tests for PEP8 conformance.
---
 tests/test_geneagrapher_methods.py | 53 ++++++++++++++----------
 tests/test_grabber_methods.py      | 58 ++++++++++++++++----------
 tests/test_graph_methods.py        | 84 ++++++++++++++++++++++++--------------
 tests/test_node_methods.py         | 40 ++++++++++--------
 tests/test_record_methods.py       | 52 ++++++++++++++---------
 tests/tests.py                     |  1 +
 6 files changed, 180 insertions(+), 108 deletions(-)

diff --git a/tests/test_geneagrapher_methods.py b/tests/test_geneagrapher_methods.py
index 28d33ff..40e1fbb 100644
--- a/tests/test_geneagrapher_methods.py
+++ b/tests/test_geneagrapher_methods.py
@@ -5,13 +5,14 @@ import StringIO
 from geneagrapher import geneagrapher
 from geneagrapher.graph import Graph
 
+
 class TestGeneagrapherMethods(unittest.TestCase):
     """
     Unit tests for the geneagrapher.Geneagrapher class.
     """
     def setUp(self):
         self.ggrapher = geneagrapher.Geneagrapher()
-        
+
     def test001_init(self):
         # Test constructor.
         self.assertEquals(isinstance(self.ggrapher.graph, Graph), True)
@@ -20,7 +21,7 @@ class TestGeneagrapherMethods(unittest.TestCase):
         self.assertEquals(self.ggrapher.get_descendants, False)
         self.assertEquals(self.ggrapher.verbose, False)
         self.assertEquals(self.ggrapher.write_filename, None)
-        
+
     def test002_parse_empty(self):
         # Test parse_input() with no arguments.
         sys.argv = ['geneagrapher']
@@ -37,7 +38,8 @@ geneagrapher: error: no record IDs given
         try:
             self.ggrapher.parse_input()
         except SystemExit:
-            self.assertEquals(stderr_intercept.getvalue().decode('utf-8'), expected)
+            self.assertEquals(stderr_intercept.getvalue().decode('utf-8'),
+                              expected)
 
         sys.stderr = stderr
 
@@ -56,7 +58,8 @@ geneagrapher: error: no record IDs given
 
     def test004_parse_options(self):
         # Test parse_input() with options.
-        sys.argv = ['geneagrapher', '--with-ancestors', '--with-descendants', '--file=filler', '--verbose', '3', '43']
+        sys.argv = ['geneagrapher', '--with-ancestors', '--with-descendants',
+                    '--file=filler', '--verbose', '3', '43']
         self.ggrapher.parse_input()
         self.assertEquals(self.ggrapher.get_ancestors, True)
         self.assertEquals(self.ggrapher.get_descendants, True)
@@ -66,7 +69,8 @@ geneagrapher: error: no record IDs given
 
     def test005_parse_short_options(self):
         # Test parse_input() with short versions of the options.
-        sys.argv = ['geneagrapher', '-a', '-d', '-f', 'filler', '-v', '3', '43']
+        sys.argv = ['geneagrapher', '-a', '-d', '-f', 'filler', '-v', '3',
+                    '43']
         self.ggrapher.parse_input()
         self.assertEquals(self.ggrapher.get_ancestors, True)
         self.assertEquals(self.ggrapher.get_descendants, True)
@@ -80,7 +84,7 @@ geneagrapher: error: no record IDs given
         self.ggrapher.build_graph()
         nodes = self.ggrapher.graph.nodes
         self.assertEquals(len(nodes), 1)
-        self.assertTrue(nodes.has_key(127946))
+        self.assertTrue(127946 in nodes)
 
         node = nodes[127946]
         self.assertEquals(node.ancestors, [137717, 137705])
@@ -106,7 +110,7 @@ geneagrapher: error: no record IDs given
 
         nodes = self.ggrapher.graph.nodes
         self.assertEquals(len(nodes), 1)
-        self.assertTrue(nodes.has_key(127946))
+        self.assertTrue(127946 in nodes)
 
         node = nodes[127946]
         self.assertEquals(node.ancestors, [137717, 137705])
@@ -128,10 +132,10 @@ geneagrapher: error: no record IDs given
         self.ggrapher.build_graph()
         nodes = self.ggrapher.graph.nodes
         self.assertEquals(len(nodes), 4)
-        self.assertTrue(nodes.has_key(127946))
-        self.assertTrue(nodes.has_key(137717))
-        self.assertTrue(nodes.has_key(137705))
-        self.assertTrue(nodes.has_key(143630))
+        self.assertTrue(127946 in nodes)
+        self.assertTrue(137717 in nodes)
+        self.assertTrue(137705 in nodes)
+        self.assertTrue(143630 in nodes)
 
         node = nodes[127946]
         self.assertEquals(node.ancestors, [137717, 137705])
@@ -180,9 +184,9 @@ geneagrapher: error: no record IDs given
         self.ggrapher.build_graph()
         nodes = self.ggrapher.graph.nodes
         self.assertEquals(len(nodes), 3)
-        self.assertTrue(nodes.has_key(79568))
-        self.assertTrue(nodes.has_key(79562))
-        self.assertTrue(nodes.has_key(99457))
+        self.assertTrue(79568 in nodes)
+        self.assertTrue(79562 in nodes)
+        self.assertTrue(99457 in nodes)
 
         node = nodes[79568]
         self.assertEquals(node.ancestors, [13301])
@@ -251,11 +255,13 @@ geneagrapher: error: no record IDs given
     node [shape=plaintext];
     edge [style=bold];
 
-    30484 [label="Peter Chris Pappas \\nThe Pennsylvania State University (1982)"];
+    30484 [label="Peter Chris Pappas \\nThe Pennsylvania State University \
+(1982)"];
 
 }
 """
-        self.assertEquals(stdout_intercept.getvalue().decode('utf-8'), expected)
+        self.assertEquals(stdout_intercept.getvalue().decode('utf-8'),
+                          expected)
 
     def test012_end_to_end_ancestors_stdout(self):
         # Complete test getting with ancestors, writing the result to stdout.
@@ -291,7 +297,8 @@ geneagrapher: error: no record IDs given
     143630 -> 137705;
 }
 """
-        self.assertEquals(stdout_intercept.getvalue().decode('utf-8'), expected)
+        self.assertEquals(stdout_intercept.getvalue().decode('utf-8'),
+                          expected)
 
     def test013_end_to_end_descendants_stdout(self):
         # Complete test getting with descendants, writing the result to stdout.
@@ -325,7 +332,8 @@ geneagrapher: error: no record IDs given
     79568 -> 99457;
 }
 """
-        self.assertEquals(stdout_intercept.getvalue().decode('utf-8'), expected)
+        self.assertEquals(stdout_intercept.getvalue().decode('utf-8'),
+                          expected)
 
     def test014_end_to_end_self_file(self):
         # Complete test getting no ancestors or descendants and writing the
@@ -347,7 +355,8 @@ geneagrapher: error: no record IDs given
     node [shape=plaintext];
     edge [style=bold];
 
-    30484 [label="Peter Chris Pappas \\nThe Pennsylvania State University (1982)"];
+    30484 [label="Peter Chris Pappas \\nThe Pennsylvania State University \
+(1982)"];
 
 }
 """
@@ -372,11 +381,13 @@ geneagrapher: error: no record IDs given
     node [shape=plaintext];
     edge [style=bold];
 
-    30484 [label="Peter Chris Pappas \\nThe Pennsylvania State University (1982)"];
+    30484 [label="Peter Chris Pappas \\nThe Pennsylvania State University \
+(1982)"];
 
 }
 """
-        self.assertEquals(stdout_intercept.getvalue().decode('utf-8'), expected)
+        self.assertEquals(stdout_intercept.getvalue().decode('utf-8'),
+                          expected)
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/tests/test_grabber_methods.py b/tests/test_grabber_methods.py
index e58cff0..9df7aeb 100644
--- a/tests/test_grabber_methods.py
+++ b/tests/test_grabber_methods.py
@@ -1,13 +1,14 @@
 import unittest
 from geneagrapher.grabber import Grabber
 
+
 class TestGrabberMethods(unittest.TestCase):
     """
     Unit tests for the Grabber class.
     """
     def setUp(self):
         self.grabber = Grabber(18231)
-        
+
     def test001_init(self):
         # Test constructor.
         self.assertEquals(self.grabber.id, 18231)
@@ -28,10 +29,12 @@ class TestGrabberMethods(unittest.TestCase):
             self.assertEquals(str(e), "Invalid id 999999999")
         else:
             self.fail()
-        
+
     def test003_extract_info_all_fields(self):
-        # Test the extract_node_information() method for a record containing all fields.
-        [name, institution, year, advisors, descendents] = self.grabber.extract_node_information()
+        # Test the extract_node_information() method for a record containing
+        # all fields.
+        [name, institution, year, advisors,
+         descendents] = self.grabber.extract_node_information()
         self.assertEquals(name, self.grabber.name)
         self.assertEquals(institution, self.grabber.institution)
         self.assertEquals(year, self.grabber.year)
@@ -40,33 +43,40 @@ class TestGrabberMethods(unittest.TestCase):
         self.assertEquals(institution, u"Universit\xe4t Helmstedt")
         self.assertEquals(year, 1799)
         self.assertEquals(advisors, [18230])
-        self.assertEquals(descendents, [18603, 18233, 62547, 29642, 55175, 29458, 19953, 18232, 151876])
-        
-        # Verify calling extract_node_information() twice does not have side effect.
-        [name, institution, year, advisors, descendents] = self.grabber.extract_node_information()
+        self.assertEquals(descendents, [18603, 18233, 62547, 29642, 55175,
+                                        29458, 19953, 18232, 151876])
+
+        # Verify calling extract_node_information() twice does not have side
+        # effect.
+        [name, institution, year, advisors,
+         descendents] = self.grabber.extract_node_information()
         self.assertEquals(name, u"Carl Friedrich Gau\xdf")
         self.assertEquals(institution, u"Universit\xe4t Helmstedt")
         self.assertEquals(year, 1799)
         self.assertEquals(advisors, [18230])
-        self.assertEquals(descendents, [18603, 18233, 62547, 29642, 55175, 29458, 19953, 18232, 151876])
-        
+        self.assertEquals(descendents, [18603, 18233, 62547, 29642, 55175,
+                                        29458, 19953, 18232, 151876])
+
     def test004_extract_info_no_advisor(self):
-        # Test the extract_node_information() method for a record with no advisor.
+        # Test the extract_node_information() method for a record with no
+        # advisor.
         grabber = Grabber(137717)
-        [name, institution, year, advisors, descendents] = grabber.extract_node_information()
+        [name, institution, year, advisors,
+         descendents] = grabber.extract_node_information()
         self.assertEquals(name, u"Valentin  Alberti")
         self.assertEquals(institution, u"Universit\xe4t Leipzig")
         self.assertEquals(year, 1678)
         self.assertEquals(advisors, [])
         self.assertEquals(descendents, [127946])
-        
+
     def test005_extract_info_no_descendants(self):
         # Test the extract_node_information() method for a record with no
         # descendants.
 
         # This is currently identical to the extract_info_no_year test.
         grabber = Grabber(53658)
-        [name, institution, year, advisors, descendents] = grabber.extract_node_information()
+        [name, institution, year, advisors,
+         descendents] = grabber.extract_node_information()
         self.assertEquals(name, u"S.  Cingolani")
         self.assertEquals(institution, u"Scuola Normale Superiore di Pisa")
         self.assertEquals(year, None)
@@ -77,18 +87,21 @@ class TestGrabberMethods(unittest.TestCase):
         # Test the extract_node_information() method for a record with no year.
         # This example also has no descendents.
         grabber = Grabber(53658)
-        [name, institution, year, advisors, descendents] = grabber.extract_node_information()
+        [name, institution, year, advisors,
+         descendents] = grabber.extract_node_information()
         self.assertEquals(name, u"S.  Cingolani")
         self.assertEquals(institution, u"Scuola Normale Superiore di Pisa")
         self.assertEquals(year, None)
         self.assertEquals(advisors, [51261])
         self.assertEquals(descendents, [])
-        
+
     def test007_extract_info_no_inst(self):
-        # Test the extract_node_information() method for a record with no institution.
+        # Test the extract_node_information() method for a record with no
+        # institution.
         # This test is also missing additional information already tested.
         grabber = Grabber(52965)
-        [name, institution, year, advisors, descendents] = grabber.extract_node_information()
+        [name, institution, year, advisors,
+         descendents] = grabber.extract_node_information()
         self.assertEquals(name, u"Walter  Mayer")
         self.assertEquals(institution, None)
         self.assertEquals(year, None)
@@ -101,16 +114,19 @@ class TestGrabberMethods(unittest.TestCase):
         # containing a slash l character. Example:
         # http://www.genealogy.math.ndsu.nodak.edu/id.php?id=7383.
         grabber = Grabber(7383)
-        [name, institution, year, advisors, descendents] = grabber.extract_node_information()
+        [name, institution, year, advisors,
+         descendents] = grabber.extract_node_information()
         self.assertEquals(name, u"W\u0142adys\u0142aw Hugo Dyonizy Steinhaus")
-        self.assertEquals(institution, u"Georg-August-Universit\xe4t G\xf6ttingen")
+        self.assertEquals(institution,
+                          u"Georg-August-Universit\xe4t G\xf6ttingen")
         self.assertEquals(year, 1911)
         self.assertEquals(advisors, [7298])
 
     def test009_multiple_advisors(self):
         # Test for multiple advisors.
         grabber = Grabber(19964)
-        [name, institution, year, advisors, descendents] = grabber.extract_node_information()
+        [name, institution, year, advisors,
+         descendents] = grabber.extract_node_information()
         self.assertEquals(name, u"Rudolf Otto Sigismund Lipschitz")
         self.assertEquals(institution, u"Universit\xe4t Berlin")
         self.assertEquals(year, 1853)
diff --git a/tests/test_graph_methods.py b/tests/test_graph_methods.py
index 7f73db1..8852c26 100644
--- a/tests/test_graph_methods.py
+++ b/tests/test_graph_methods.py
@@ -1,85 +1,96 @@
 import unittest
 from geneagrapher.graph import DuplicateNodeError, Graph, Node, Record
 
+
 class TestGraphMethods(unittest.TestCase):
     """
     Unit tests for the Graph class.
     """
     def setUp(self):
-        self.record1 = Record(u"Carl Friedrich Gau\xdf", u"Universit\xe4t Helmstedt", 1799, 18231)
+        self.record1 = Record(u"Carl Friedrich Gau\xdf",
+                              u"Universit\xe4t Helmstedt", 1799, 18231)
         self.node1 = Node(self.record1, [], [])
         self.graph1 = Graph([self.node1])
-    
+
     def test001_init_empty(self):
         # Test the constructor.
         graph = Graph()
         self.assertEquals(graph.seeds, None)
-        
+
     def test002_init(self):
         # Test the constructor.
         self.assert_(self.graph1.seeds == [self.node1])
         self.assertEquals(self.graph1.nodes.keys(), [18231])
         self.assertEquals(self.graph1.nodes[18231], self.node1)
-        
+
     def test003_init_bad_seeds(self):
         # Test the constructor when passed a bad type for the seeds parameter.
         self.assertRaises(TypeError, Graph, 3)
-        
+
     def test004_has_node_true(self):
         # Test the has_node() method for a True case.
         self.assertEquals(self.graph1.has_node(18231), True)
-        
+
     def test005_has_node_false(self):
         # Test the has_node() method for a False case.
         self.assertEquals(self.graph1.has_node(1), False)
-        
+
     def test006_get_node(self):
         # Test the get_node() method.
         node = self.graph1.get_node(18231)
         self.assert_(node == self.node1)
-        
+
     def test007_get_node_not_found(self):
         # Test the get_node() method for a case where the node does not exist.
         self.assertRaises(KeyError, self.graph1.get_node, 1)
-        
+
     def test008_get_node_list(self):
         # Test the get_node_list() method.
         self.assertEquals(self.graph1.get_node_list(), [18231])
-        
+
     def test008_get_node_list_empty(self):
         # Test the get_node_list() method for an empty graph.
         graph = Graph()
         self.assertEquals(graph.get_node_list(), [])
-        
+
     def test009_add_node(self):
         # Test the add_node() method.
-        self.graph1.add_node("Leonhard Euler", "Universitaet Basel", 1726, 38586, [], [])
+        self.graph1.add_node("Leonhard Euler", "Universitaet Basel", 1726,
+                             38586, [], [])
         self.assertEquals([38586, 18231], self.graph1.get_node_list())
         self.assertEquals(self.graph1.seeds, [self.node1])
 
     def test010_add_second_node_seed(self):
         # Test the add_node() method when adding a second node and
         # marking it as a seed node.
-        self.graph1.add_node("Leonhard Euler", "Universitaet Basel", 1726, 38586, [], [], True)
+        self.graph1.add_node("Leonhard Euler", "Universitaet Basel", 1726,
+                             38586, [], [], True)
         self.assertEquals([38586, 18231], self.graph1.get_node_list())
-        self.assertEquals(self.graph1.seeds, [self.node1, self.graph1.get_node(38586)])
+        self.assertEquals(self.graph1.seeds, [self.node1,
+                                              self.graph1.get_node(38586)])
 
     def test011_add_node_seed(self):
         # Test the add_node() method when no seeds exist.
         graph = Graph()
         self.assertEquals(graph.seeds, None)
-        graph.add_node("Leonhard Euler", "Universitaet Basel", 1726, 38586, [], [])
+        graph.add_node("Leonhard Euler", "Universitaet Basel", 1726,
+                       38586, [], [])
         self.assertEquals(graph.seeds, [graph.get_node(38586)])
 
     def test012_add_node_already_present(self):
-        self.graph1.add_node("Leonhard Euler", "Universitaet Basel", 1726, 38586, [], [])
+        self.graph1.add_node("Leonhard Euler", "Universitaet Basel", 1726,
+                             38586, [], [])
         self.assertEquals([38586, 18231], self.graph1.get_node_list())
-        self.assertRaises(DuplicateNodeError, self.graph1.add_node, "Leonhard Euler", "Universitaet Basel", 1726, 38586, [], [])
+        self.assertRaises(DuplicateNodeError, self.graph1.add_node,
+                          "Leonhard Euler", "Universitaet Basel",
+                          1726, 38586, [], [])
 
         try:
-            self.graph1.add_node("Leonhard Euler", "Universitaet Basel", 1726, 38586, [], [])
+            self.graph1.add_node("Leonhard Euler", "Universitaet Basel",
+                                 1726, 38586, [], [])
         except DuplicateNodeError as e:
-            self.assertEquals(str(e), "node with id {} already exists".format(38586))
+            self.assertEquals(str(e),
+                              "node with id {} already exists".format(38586))
         else:
             self.fail()
 
@@ -101,30 +112,41 @@ class TestGraphMethods(unittest.TestCase):
     18231 [label="Carl Friedrich Gau\xdf \\nUniversit\xe4t Helmstedt (1799)"];
 
 }
-"""    
+"""
         dotfile = self.graph1.generate_dot_file(True, False)
         self.assertEquals(dotfile, dotfileexpt)
-        
+
     def test015_generate_dot_file(self):
         # Test the generate_dot_file() method.
         graph = Graph()
-        graph.add_node(u"Carl Friedrich Gau\xdf", u"Universit\xe4t Helmstedt", 1799, 18231, [18230], [])
-        graph.add_node(u"Johann Friedrich Pfaff", u"Georg-August-Universit\xe4t Goettingen", 1786, 18230, [66476], [])
-        graph.add_node(u"Abraham Gotthelf Kaestner", u"Universit\xe4t Leipzig", 1739, 66476, [57670], [])
-        graph.add_node(u"Christian August Hausen", u"Martin-Luther-Universit\xe4t Halle-Wittenberg", 1713, 57670, [72669], [])
-        graph.add_node(u"Johann Christoph Wichmannshausen", u"Universit\xe4t Leipzig", 1685, 72669, [21235], [])
-        graph.add_node(u"Otto Mencke", u"Universit\xe4t Leipzig", 1665, 21235, [], [])
-        
+        graph.add_node(u"Carl Friedrich Gau\xdf", u"Universit\xe4t Helmstedt",
+                       1799, 18231, [18230], [])
+        graph.add_node(u"Johann Friedrich Pfaff",
+                       u"Georg-August-Universit\xe4t Goettingen", 1786, 18230,
+                       [66476], [])
+        graph.add_node(u"Abraham Gotthelf Kaestner", u"Universit\xe4t Leipzig",
+                       1739, 66476, [57670], [])
+        graph.add_node(u"Christian August Hausen",
+                       u"Martin-Luther-Universit\xe4t Halle-Wittenberg", 1713,
+                       57670, [72669], [])
+        graph.add_node(u"Johann Christoph Wichmannshausen",
+                       u"Universit\xe4t Leipzig", 1685, 72669, [21235], [])
+        graph.add_node(u"Otto Mencke", u"Universit\xe4t Leipzig", 1665, 21235,
+                       [], [])
+
         dotfileexpt = u"""digraph genealogy {
     graph [charset="utf-8"];
     node [shape=plaintext];
     edge [style=bold];
 
     18231 [label="Carl Friedrich Gau\xdf \\nUniversit\xe4t Helmstedt (1799)"];
-    18230 [label="Johann Friedrich Pfaff \\nGeorg-August-Universit\xe4t Goettingen (1786)"];
+    18230 [label="Johann Friedrich Pfaff \\nGeorg-August-Universit\xe4t \
+Goettingen (1786)"];
     66476 [label="Abraham Gotthelf Kaestner \\nUniversit\xe4t Leipzig (1739)"];
-    57670 [label="Christian August Hausen \\nMartin-Luther-Universit\xe4t Halle-Wittenberg (1713)"];
-    72669 [label="Johann Christoph Wichmannshausen \\nUniversit\xe4t Leipzig (1685)"];
+    57670 [label="Christian August Hausen \\nMartin-Luther-Universit\xe4t \
+Halle-Wittenberg (1713)"];
+    72669 [label="Johann Christoph Wichmannshausen \\nUniversit\xe4t Leipzig \
+(1685)"];
     21235 [label="Otto Mencke \\nUniversit\xe4t Leipzig (1665)"];
 
     18230 -> 18231;
diff --git a/tests/test_node_methods.py b/tests/test_node_methods.py
index 103596e..8e6021e 100644
--- a/tests/test_node_methods.py
+++ b/tests/test_node_methods.py
@@ -1,38 +1,43 @@
 import unittest
 from geneagrapher.graph import Node, Record
 
+
 class TestNodeMethods(unittest.TestCase):
     """
     Unit tests for the Node class.
     """
     def setUp(self):
-        self.record = Record(u"Carl Friedrich Gau\xdf", u"Universit\xe4t Helmstedt", 1799, 18231)
-    
+        self.record = Record(u"Carl Friedrich Gau\xdf",
+                             u"Universit\xe4t Helmstedt", 1799, 18231)
+
     def test001_init(self):
         # Test the constructor.
         node = Node(self.record, [], [])
         self.assertEquals(node.record, self.record)
         self.assertEquals(node.ancestors, [])
         self.assertEquals(node.descendants, [])
-        
+
     def test002_init_bad_record(self):
-        # Test the constructor for a case where the record passed is not a Record
-        # object.
+        # Test the constructor for a case where the record passed is not a
+        # Record object.
         self.assertRaises(TypeError, Node, 1, [], [])
-        
+
     def test003_init_bad_ancestor_list(self):
-        # Test the constructor for a case where the ancestor list is not a list.
+        # Test the constructor for a case where the ancestor list is not a
+        # list.
         self.assertRaises(TypeError, Node, self.record, 1, [])
 
     def test003_2_init_bad_descendent_list(self):
-        # Test the constructor for a case where the descendent list is not a list.
+        # Test the constructor for a case where the descendent list is not a
+        # list.
         self.assertRaises(TypeError, Node, self.record, [], 1)
-        
+
     def test004_unicode_full(self):
         # Test __unicode__() method for Node with complete record.
         node = Node(self.record, [], [])
         nodestr = node.__unicode__()
-        nodestrexpt = u"Carl Friedrich Gau\xdf \\nUniversit\xe4t Helmstedt (1799)"
+        nodestrexpt = u"Carl Friedrich Gau\xdf \\nUniversit\xe4t Helmstedt \
+(1799)"
         self.assertEquals(nodestr, nodestrexpt)
 
     def test005_unicode_no_year(self):
@@ -44,7 +49,8 @@ class TestNodeMethods(unittest.TestCase):
         self.assertEquals(nodestr, nodestrexpt)
 
     def test006_unicode_no_inst(self):
-        # Test __unicode__() method for Node containing record without institution.
+        # Test __unicode__() method for Node containing record without
+        # institution.
         record = Record(self.record.name, None, 1799, 18231)
         node = Node(record, [], [])
         nodestr = node.__unicode__()
@@ -52,8 +58,8 @@ class TestNodeMethods(unittest.TestCase):
         self.assertEquals(nodestr, nodestrexpt)
 
     def test007_unicode_no_inst_no_id(self):
-        # Test __unicode__() method for Node containing record without institution
-        # or year.
+        # Test __unicode__() method for Node containing record without
+        # institution or year.
         record = Record(self.record.name, None, None, 18231)
         node = Node(record, [], [])
         nodestr = node.__unicode__()
@@ -62,7 +68,8 @@ class TestNodeMethods(unittest.TestCase):
 
     def test008_cmp_equal(self):
         # Test comparison method for Nodes with identical records.
-        record2 = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", 1799, 18231)
+        record2 = Record("Carl Friedrich Gauss", "Universitaet Helmstedt",
+                         1799, 18231)
         node1 = Node(self.record, [], [])
         node2 = Node(record2, [], [])
         self.assert_(node1 == node2)
@@ -81,10 +88,11 @@ class TestNodeMethods(unittest.TestCase):
         self.assertEquals(node.ancestors, [5])
 
     def test011_add_ancestor_bad_type(self):
-        # Test the add_ancestor() method for a case where the parameter type is incorrect.
+        # Test the add_ancestor() method for a case where the parameter type
+        # is incorrect.
         node = Node(self.record, [], [])
         self.assertRaises(TypeError, node.add_ancestor, '5')
-        
+
     def test012_get_id(self):
         node = Node(self.record, [], [])
         self.assertEquals(node.get_id(), 18231)
diff --git a/tests/test_record_methods.py b/tests/test_record_methods.py
index 42ed696..b07b35e 100644
--- a/tests/test_record_methods.py
+++ b/tests/test_record_methods.py
@@ -1,76 +1,90 @@
 import unittest
 from geneagrapher.graph import Record
 
+
 # Unit tests for graph-related classes.
 class TestRecordMethods(unittest.TestCase):
     """
     Unit tests for the Record class.
     """
     def setUp(self):
-        self.record = Record(u"Carl Friedrich Gau\xdf", u"Universit\xe4t Helmstedt", 1799, 18231)
+        self.record = Record(u"Carl Friedrich Gau\xdf",
+                             u"Universit\xe4t Helmstedt", 1799, 18231)
 
     def test001_init(self):
         # Test the constructor.
-        record = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", 1799, 18231)
+        record = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", 1799,
+                        18231)
         self.assertEqual(record.name, "Carl Friedrich Gauss")
         self.assertEqual(record.institution, "Universitaet Helmstedt")
         self.assertEqual(record.year, 1799)
         self.assertEqual(record.id, 18231)
-        
+
     def test002_init_bad_name(self):
         # Test constructor with bad 'name' parameter.
-        self.assertRaises(TypeError, Record, 1, "Universitaet Helmstedt", 1799, 18231)
-        
+        self.assertRaises(TypeError, Record, 1, "Universitaet Helmstedt", 1799,
+                          18231)
+
     def test003_init_bad_institution(self):
         # Test constructor with bad 'institution' parameter.
-        self.assertRaises(TypeError, Record, "Carl Friedrich Gauss", 1, 1799, 18231)
-        
+        self.assertRaises(TypeError, Record, "Carl Friedrich Gauss", 1, 1799,
+                          18231)
+
     def test004_init_bad_year(self):
         # Test constructor with bad 'year' parameter.
         self.assertRaises(TypeError, Record, "Carl Friedrich Gauss",
                           "Universitaet Helmstedt", "1799", 18231)
-        
+
     def test005_init_bad_id(self):
         # Test constructor with bad 'id' parameter.
         self.assertRaises(TypeError, Record, "Carl Friedrich Gauss",
                           "Universitaet Helmstedt", 1799, "18231")
-        
+
     def test006_cmp_equal(self):
         # Verify two 'equal' records are compared correctly.
-        record1 = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", 1799, 18231)
-        record2 = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", 1799, 18231)
+        record1 = Record("Carl Friedrich Gauss", "Universitaet Helmstedt",
+                         1799, 18231)
+        record2 = Record("Carl Friedrich Gauss", "Universitaet Helmstedt",
+                         1799, 18231)
         self.assert_(record1 == record2)
-        
+
     def test007_cmp_unequal(self):
         # Verify two 'unequal' records are compared correctly.
-        record1 = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", 1799, 18231)
+        record1 = Record("Carl Friedrich Gauss", "Universitaet Helmstedt",
+                         1799, 18231)
         record2 = Record("Leonhard Euler", "Universitaet Basel", 1726, 38586)
         self.assert_(record1 < record2)
 
     def test008_has_institution_yes(self):
-        # Verify has_institution() method returns True when the conditions are right.
-        record = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", 1799, 18231)
+        # Verify has_institution() method returns True when the conditions are
+        # right.
+        record = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", 1799,
+                        18231)
         self.assert_(record.has_institution())
 
     def test009_has_institution_no(self):
-        # Verify has_institution() method returns False when the conditions are right.
+        # Verify has_institution() method returns False when the conditions are
+        # right.
         record = Record("Carl Friedrich Gauss", None, 1799, 18231)
         self.assert_(not record.has_institution())
 
     def test010_has_year_yes(self):
         # Verify has_year() method returns True when the conditions are right.
-        record = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", 1799, 18231)
+        record = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", 1799,
+                        18231)
         self.assert_(record.has_year())
 
     def test011_has_year_no(self):
         # Verify has_year() method returns False when the conditions are right.
-        record = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", None, 18231)
+        record = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", None,
+                        18231)
         self.assert_(not record.has_year())
 
     def test012_unicode_full(self):
         # Test __unicode__() method for complete record.
         recstr = self.record.__unicode__()
-        recstrexpt = u"Carl Friedrich Gau\xdf \\nUniversit\xe4t Helmstedt (1799)"
+        recstrexpt = u"Carl Friedrich Gau\xdf \\nUniversit\xe4t Helmstedt \
+(1799)"
         self.assertEquals(recstr, recstrexpt)
 
     def test013_unicode_no_year(self):
diff --git a/tests/tests.py b/tests/tests.py
index d86de96..1cdc5a5 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -5,6 +5,7 @@ from test_graph_methods import TestGraphMethods
 from test_grabber_methods import TestGrabberMethods
 from test_geneagrapher_methods import TestGeneagrapherMethods
 
+
 def runTests():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(TestRecordMethods))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/geneagrapher.git



More information about the debian-science-commits mailing list