[geneagrapher] 186/226: Changed the comments at start of test methods to docstrings.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Sat Jul 11 17:11:06 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 5a91ee10c4b3e658f62951860e0aad7c38bbbbc3
Author: David Alber <alber.david at gmail.com>
Date: Wed Nov 30 23:19:46 2011 -0800
Changed the comments at start of test methods to docstrings.
This closes #4.
---
tests/test_geneagrapher_methods.py | 44 ++++++++++++++++---------------
tests/test_grabber_methods.py | 35 ++++++++++++-------------
tests/test_graph_methods.py | 53 ++++++++++++++++++++------------------
tests/test_node_methods.py | 45 ++++++++++++++++----------------
tests/test_record_methods.py | 43 ++++++++++++++++---------------
5 files changed, 113 insertions(+), 107 deletions(-)
diff --git a/tests/test_geneagrapher_methods.py b/tests/test_geneagrapher_methods.py
index 49de5f9..ef416e4 100644
--- a/tests/test_geneagrapher_methods.py
+++ b/tests/test_geneagrapher_methods.py
@@ -7,14 +7,12 @@ from geneagrapher.graph import Graph
class TestGeneagrapherMethods(unittest.TestCase):
- """
- Unit tests for the geneagrapher.Geneagrapher class.
- """
+ """Unit tests for the geneagrapher.Geneagrapher class."""
def setUp(self):
self.ggrapher = geneagrapher.Geneagrapher()
def test001_init(self):
- # Test constructor.
+ """Test constructor."""
self.assertEqual(isinstance(self.ggrapher.graph, Graph), True)
self.assertEqual(self.ggrapher.seed_ids, [])
self.assertEqual(self.ggrapher.get_ancestors, False)
@@ -23,7 +21,7 @@ class TestGeneagrapherMethods(unittest.TestCase):
self.assertEqual(self.ggrapher.write_filename, None)
def test002_parse_empty(self):
- # Test parse_input() with no arguments.
+ """Test parse_input() with no arguments."""
sys.argv = ['geneagrapher']
# Redirect stderr to capture output.
@@ -44,7 +42,7 @@ geneagrapher: error: no record IDs given
sys.stderr = stderr
def test003_parse_default(self):
- # Test parse_input() with no options.
+ """Test parse_input() with no options."""
sys.argv = ['geneagrapher', '3']
self.ggrapher.get_ancestors = False
self.ggrapher.get_descendents = True
@@ -57,7 +55,7 @@ geneagrapher: error: no record IDs given
self.assertEqual(self.ggrapher.seed_ids, [3])
def test004_parse_options(self):
- # Test parse_input() with options.
+ """Test parse_input() with options."""
sys.argv = ['geneagrapher', '--with-ancestors', '--with-descendants',
'--file=filler', '--verbose', '3', '43']
self.ggrapher.parse_input()
@@ -68,7 +66,7 @@ geneagrapher: error: no record IDs given
self.assertEqual(self.ggrapher.seed_ids, [3, 43])
def test005_parse_short_options(self):
- # Test parse_input() with short versions of the options.
+ """Test parse_input() with short versions of the options."""
sys.argv = ['geneagrapher', '-a', '-d', '-f', 'filler', '-v', '3',
'43']
self.ggrapher.parse_input()
@@ -79,7 +77,7 @@ geneagrapher: error: no record IDs given
self.assertEqual(self.ggrapher.seed_ids, [3, 43])
def test006_build_graph_only_self(self):
- # Graph building with no ancestors or descendants.
+ """Graph building with no ancestors or descendants."""
self.ggrapher.seed_ids.append(127946)
self.ggrapher.build_graph()
graph = self.ggrapher.graph
@@ -97,7 +95,7 @@ geneagrapher: error: no record IDs given
self.assertEqual(record.id, 127946)
def test007_build_graph_only_self_verbose(self):
- # Graph building with no ancestors or descendants.
+ """Graph building with no ancestors or descendants."""
self.ggrapher.verbose = True
self.ggrapher.seed_ids.append(127946)
@@ -126,7 +124,7 @@ geneagrapher: error: no record IDs given
u"Grabbing record #127946\n")
def test008_build_graph_with_ancestors(self):
- # Graph building with ancestors.
+ """Graph building with ancestors."""
self.ggrapher.seed_ids.append(127946)
self.ggrapher.get_ancestors = True
self.ggrapher.build_graph()
@@ -178,7 +176,7 @@ geneagrapher: error: no record IDs given
self.assertEqual(record.id, 143630)
def test009_build_graph_with_descendants(self):
- # Graph building with descendants.
+ """Graph building with descendants."""
self.ggrapher.seed_ids.append(79568)
self.ggrapher.get_descendants = True
self.ggrapher.build_graph()
@@ -219,7 +217,7 @@ geneagrapher: error: no record IDs given
self.assertEqual(record.id, 99457)
def test010_build_graph_bad_id(self):
- # Graph building with a bad ID.
+ """Graph building with a bad ID."""
self.ggrapher.seed_ids.append(79568583832)
self.assertRaises(ValueError, self.ggrapher.build_graph)
@@ -231,8 +229,8 @@ geneagrapher: error: no record IDs given
self.fail()
def test011_end_to_end_self_stdout(self):
- # Complete test getting no ancestors or descendants and writing the
- # result to stdout.
+ """Complete test getting no ancestors or descendants and writing the
+ result to stdout."""
sys.argv = ['geneagrapher', '30484']
self.ggrapher.parse_input()
self.assertEqual(self.ggrapher.get_ancestors, False)
@@ -263,7 +261,9 @@ geneagrapher: error: no record IDs given
self.assertEqual(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.
+ """
+ Complete test getting with ancestors, writing the result to stdout.
+ """
sys.argv = ['geneagrapher', '-a', '127946']
self.ggrapher.parse_input()
self.assertEqual(self.ggrapher.get_ancestors, True)
@@ -299,7 +299,9 @@ geneagrapher: error: no record IDs given
self.assertEqual(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.
+ """
+ Complete test getting with descendants, writing the result to stdout.
+ """
sys.argv = ['geneagrapher', '-d', '79568']
self.ggrapher.parse_input()
self.assertEqual(self.ggrapher.get_ancestors, False)
@@ -333,8 +335,8 @@ geneagrapher: error: no record IDs given
self.assertEqual(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
- # result to stdout.
+ """Complete test getting no ancestors or descendants and writing the
+ # result to stdout."""
outfname = 'outfile.test'
sys.argv = ['geneagrapher', '-f', outfname, '30484']
self.ggrapher.parse_input()
@@ -362,8 +364,8 @@ geneagrapher: error: no record IDs given
os.remove(outfname)
def test015_end_to_end_through_ggrapher_self_stdout(self):
- # Complete test calling ggrapher getting no ancestors or descendants
- # and writing the result to stdout.
+ """Complete test calling ggrapher getting no ancestors or descendants
+ and writing the result to stdout."""
sys.argv = ['geneagrapher', '30484']
# Redirect stdout to capture output.
diff --git a/tests/test_grabber_methods.py b/tests/test_grabber_methods.py
index 0d82074..baf8080 100644
--- a/tests/test_grabber_methods.py
+++ b/tests/test_grabber_methods.py
@@ -3,14 +3,12 @@ from geneagrapher.grabber import Grabber
class TestGrabberMethods(unittest.TestCase):
- """
- Unit tests for the Grabber class.
- """
+ """Unit tests for the Grabber class."""
def setUp(self):
self.grabber = Grabber(18231)
def test001_init(self):
- # Test constructor.
+ """Test constructor."""
self.assertEqual(self.grabber.id, 18231)
self.assertEqual(self.grabber.name, None)
self.assertEqual(self.grabber.institution, None)
@@ -19,7 +17,7 @@ class TestGrabberMethods(unittest.TestCase):
self.assertEqual(self.grabber.descendants, set([]))
def test002_extract_info_bad(self):
- # Verify exception thrown for bad id.
+ """Verify exception thrown for bad id."""
grabber = Grabber(999999999)
self.assertRaises(ValueError, grabber.extract_node_information)
@@ -31,8 +29,8 @@ class TestGrabberMethods(unittest.TestCase):
self.fail()
def test003_extract_info_all_fields(self):
- # Test the extract_node_information() method for a record containing
- # all fields.
+ """Test the extract_node_information() method for a record containing
+ all fields."""
[name, institution, year, advisors,
descendents] = self.grabber.extract_node_information()
self.assertEqual(name, self.grabber.name)
@@ -58,8 +56,8 @@ class TestGrabberMethods(unittest.TestCase):
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()
@@ -70,9 +68,8 @@ class TestGrabberMethods(unittest.TestCase):
self.assertEqual(descendents, set([127946]))
def test005_extract_info_no_descendants(self):
- # Test the extract_node_information() method for a record with no
- # descendants.
-
+ """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,
@@ -84,7 +81,9 @@ class TestGrabberMethods(unittest.TestCase):
self.assertEqual(descendents, set([]))
def test006_extract_info_no_year(self):
- # Test the extract_node_information() method for a record with no year.
+ """
+ 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,
@@ -96,8 +95,8 @@ class TestGrabberMethods(unittest.TestCase):
self.assertEqual(descendents, set([]))
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,
@@ -110,9 +109,9 @@ class TestGrabberMethods(unittest.TestCase):
# Tests for special (from my point of view) characters:
def test008_slash_l(self):
- # Test the extract_node_information() method for a record
+ """Test the extract_node_information() method for a record
# containing a slash l character. Example:
- # http://www.genealogy.math.ndsu.nodak.edu/id.php?id=7383.
+ # http://www.genealogy.math.ndsu.nodak.edu/id.php?id=7383."""
grabber = Grabber(7383)
[name, institution, year, advisors,
descendents] = grabber.extract_node_information()
@@ -126,7 +125,7 @@ class TestGrabberMethods(unittest.TestCase):
15165, 89841, 84016]))
def test009_multiple_advisors(self):
- # Test for multiple advisors.
+ """Test for multiple advisors."""
grabber = Grabber(19964)
[name, institution, year, advisors,
descendents] = grabber.extract_node_information()
diff --git a/tests/test_graph_methods.py b/tests/test_graph_methods.py
index c542f81..d147780 100644
--- a/tests/test_graph_methods.py
+++ b/tests/test_graph_methods.py
@@ -3,9 +3,7 @@ from geneagrapher.graph import DuplicateNodeError, Graph, Node, Record
class TestGraphMethods(unittest.TestCase):
- """
- Unit tests for the Graph class.
- """
+ """Unit tests for the Graph class."""
def setUp(self):
self.record1 = Record(u"Carl Friedrich Gau\xdf",
u"Universit\xe4t Helmstedt", 1799, 18231)
@@ -13,71 +11,75 @@ class TestGraphMethods(unittest.TestCase):
self.graph1 = Graph(set([self.node1]))
def test001_init_empty(self):
- # Test the constructor.
+ """Test the constructor with an empty seeds set."""
graph = Graph()
self.assertEqual(graph.seeds, set())
def test002_init(self):
- # Test the constructor.
+ """Test the constructor."""
self.assertEqual(self.graph1.seeds, set([18231]))
self.assertEqual(self.graph1.keys(), [18231])
self.assertEqual(self.graph1[18231], self.node1)
def test003_init_bad_seeds(self):
- # Test the constructor when passed a bad type for the seeds parameter.
+ """
+ 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.
+ """Test the has_node() method for a True case."""
self.assertEqual(self.graph1.has_node(18231), True)
def test005_has_node_false(self):
- # Test the has_node() method for a False case.
+ """Test the has_node() method for a False case."""
self.assertEqual(self.graph1.has_node(1), False)
def test004_has_node_true(self):
- # Test the __contains__() method for a True case.
+ """Test the __contains__() method for a True case."""
self.assertEqual(18231 in self.graph1, True)
def test005_has_node_false(self):
- # Test the __contains__() method for a False case.
+ """Test the __contains__() method for a False case."""
self.assertEqual(1 in self.graph1, False)
def test006_get_node(self):
- # Test the get_node() method.
+ """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.
+ """
+ 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.
+ """Test the get_node_list() method."""
self.assertEqual(self.graph1.get_node_list(), [18231])
def test008_get_node_list_empty(self):
- # Test the get_node_list() method for an empty graph.
+ """Test the get_node_list() method for an empty graph."""
graph = Graph()
self.assertEqual(graph.get_node_list(), [])
def test009_add_node(self):
- # Test the add_node() method.
+ """Test the add_node() method."""
self.graph1.add_node("Leonhard Euler", "Universitaet Basel", 1726,
38586, set(), set())
self.assertEqual([38586, 18231], self.graph1.get_node_list())
self.assertEqual(self.graph1.seeds, set([18231]))
def test010_add_second_node_seed(self):
- # Test the add_node() method when adding a second node and
- # marking it as a seed node.
+ """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, set(), set(), True)
self.assertEqual([38586, 18231], self.graph1.get_node_list())
self.assertEqual(self.graph1.seeds, set([18231, 38586]))
def test011_add_node_seed(self):
- # Test the add_node() method when no seeds exist.
+ """Test the add_node() method when no seeds exist."""
graph = Graph()
self.assertEqual(graph.seeds, set())
graph.add_node("Leonhard Euler", "Universitaet Basel", 1726,
@@ -85,6 +87,7 @@ class TestGraphMethods(unittest.TestCase):
self.assertEqual(graph.seeds, set([38586]))
def test012_add_node_already_present(self):
+ """Test for expected exception when adding a duplicate node."""
self.graph1.add_node("Leonhard Euler", "Universitaet Basel", 1726,
38586, set(), set())
self.assertEqual([38586, 18231], self.graph1.get_node_list())
@@ -102,7 +105,7 @@ class TestGraphMethods(unittest.TestCase):
self.fail()
def test013_add_node_object(self):
- # Test the add_node_object() method.
+ """Test the add_node_object() method."""
record = Record("Leonhard Euler", "Universitaet Basel", 1726, 38586)
node = Node(record, set(), set())
self.graph1.add_node_object(node)
@@ -110,7 +113,7 @@ class TestGraphMethods(unittest.TestCase):
self.assertEqual(self.graph1.seeds, set([18231]))
def test014_generate_dot_file(self):
- # Test the generate_dot_file() method.
+ """Test the generate_dot_file() method."""
dotfileexpt = u"""digraph genealogy {
graph [charset="utf-8"];
node [shape=plaintext];
@@ -124,7 +127,7 @@ class TestGraphMethods(unittest.TestCase):
self.assertEqual(dotfile, dotfileexpt)
def test015_generate_dot_file(self):
- # Test the generate_dot_file() method.
+ """Test the generate_dot_file() method."""
graph = Graph()
graph.add_node(u"Carl Friedrich Gau\xdf", u"Universit\xe4t Helmstedt",
1799, 18231, set([18230]), set())
@@ -168,8 +171,8 @@ Halle-Wittenberg (1713)"];
self.assertEqual(dotfile, dotfileexpt)
def test016_incremental_ancestor_descendant_check(self):
- # Test the contents of the ancestors and descendants members of a
- # graph's nodes as they are added.
+ """Test the contents of the ancestors and descendants members of a
+ graph's nodes as they are added."""
graph = Graph()
graph.add_node(u"Carl Friedrich Gau\xdf", u"Universit\xe4t Helmstedt",
1799, 18231, set([18230]), set([18603, 18233, 62547]))
@@ -241,9 +244,9 @@ Halle-Wittenberg (1713)"];
self.assertEqual(node6.descendants, set([72669]))
def test017_incremental_ancestor_descendant_check2(self):
- # Test the contents of the ancestors and descendants members of a
+ """Test the contents of the ancestors and descendants members of a
# graph's nodes as they are added inserted in a different ofder than
- # in the previous test.
+ # in the previous test."""
graph = Graph()
graph.add_node(u"Abraham Gotthelf Kaestner", u"Universit\xe4t Leipzig",
1739, 66476, set([57670]), set([18230]))
diff --git a/tests/test_node_methods.py b/tests/test_node_methods.py
index eb1db30..62fcae2 100644
--- a/tests/test_node_methods.py
+++ b/tests/test_node_methods.py
@@ -3,37 +3,35 @@ from geneagrapher.graph import Node, Record
class TestNodeMethods(unittest.TestCase):
- """
- Unit tests for the Node class.
- """
+ """Unit tests for the Node class."""
def setUp(self):
self.record = Record(u"Carl Friedrich Gau\xdf",
u"Universit\xe4t Helmstedt", 1799, 18231)
def test001_init(self):
- # Test the constructor.
+ """Test the constructor."""
node = Node(self.record, set(), set())
self.assertEqual(node.record, self.record)
self.assertEqual(node.ancestors, set())
self.assertEqual(node.descendants, set())
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, set(), set())
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, set())
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, set(), 1)
def test004_unicode_full(self):
- # Test __unicode__() method for Node with complete record.
+ """Test __unicode__() method for Node with complete record."""
node = Node(self.record, set(), set())
nodestr = node.__unicode__()
nodestrexpt = u"Carl Friedrich Gau\xdf \\nUniversit\xe4t Helmstedt \
@@ -41,7 +39,9 @@ class TestNodeMethods(unittest.TestCase):
self.assertEqual(nodestr, nodestrexpt)
def test005_unicode_no_year(self):
- # Test __unicode__() method for Node containing record without year.
+ """
+ Test __unicode__() method for Node containing record without year.
+ """
record = Record(self.record.name, self.record.institution, None, 18231)
node = Node(record, set(), set())
nodestr = node.__unicode__()
@@ -49,8 +49,8 @@ class TestNodeMethods(unittest.TestCase):
self.assertEqual(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, set(), set())
nodestr = node.__unicode__()
@@ -58,8 +58,8 @@ class TestNodeMethods(unittest.TestCase):
self.assertEqual(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, set(), set())
nodestr = node.__unicode__()
@@ -67,7 +67,7 @@ class TestNodeMethods(unittest.TestCase):
self.assertEqual(nodestr, nodestrexpt)
def test008_cmp_equal(self):
- # Test comparison method for Nodes with identical records.
+ """Test comparison method for Nodes with identical records."""
record2 = Record("Carl Friedrich Gauss", "Universitaet Helmstedt",
1799, 18231)
node1 = Node(self.record, set(), set())
@@ -75,30 +75,31 @@ class TestNodeMethods(unittest.TestCase):
self.assert_(node1 == node2)
def test009_cmp_unequal(self):
- # Test comparison method for Nodes with different records.
+ """Test comparison method for Nodes with different records."""
record2 = Record("Leonhard Euler", "Universitaet Basel", 1726, 38586)
node1 = Node(self.record, set(), set())
node2 = Node(record2, set(), set())
self.assert_(node1 < node2)
def test010_add_ancestor(self):
- # Test the add_ancestor() method.
+ """Test the add_ancestor() method."""
node = Node(self.record, set(), set())
node.add_ancestor(5)
self.assertEqual(node.ancestors, set([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, set(), set())
self.assertRaises(TypeError, node.add_ancestor, '5')
def test012_get_id(self):
+ """Test the get_id() method."""
node = Node(self.record, set(), set())
self.assertEqual(node.get_id(), 18231)
def test013_set_id(self):
- # Test the set_id() method.
+ """Test the set_id() method."""
node = Node(self.record, set(), set())
self.assertEqual(node.get_id(), 18231)
node.set_id(15)
diff --git a/tests/test_record_methods.py b/tests/test_record_methods.py
index 58a77d8..45fa5c3 100644
--- a/tests/test_record_methods.py
+++ b/tests/test_record_methods.py
@@ -4,15 +4,13 @@ from geneagrapher.graph import Record
# Unit tests for graph-related classes.
class TestRecordMethods(unittest.TestCase):
- """
- Unit tests for the Record class.
- """
+ """Unit tests for the Record class."""
def setUp(self):
self.record = Record(u"Carl Friedrich Gau\xdf",
u"Universit\xe4t Helmstedt", 1799, 18231)
def test001_init(self):
- # Test the constructor.
+ """Test the constructor."""
record = Record("Carl Friedrich Gauss", "Universitaet Helmstedt", 1799,
18231)
self.assertEqual(record.name, "Carl Friedrich Gauss")
@@ -21,27 +19,27 @@ class TestRecordMethods(unittest.TestCase):
self.assertEqual(record.id, 18231)
def test002_init_bad_name(self):
- # Test constructor with bad 'name' parameter.
+ """Test constructor with bad 'name' parameter."""
self.assertRaises(TypeError, Record, 1, "Universitaet Helmstedt", 1799,
18231)
def test003_init_bad_institution(self):
- # Test constructor with bad 'institution' parameter.
+ """Test constructor with bad 'institution' parameter."""
self.assertRaises(TypeError, Record, "Carl Friedrich Gauss", 1, 1799,
18231)
def test004_init_bad_year(self):
- # Test constructor with bad 'year' parameter.
+ """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.
+ """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.
+ """Verify two 'equal' records are compared correctly."""
record1 = Record("Carl Friedrich Gauss", "Universitaet Helmstedt",
1799, 18231)
record2 = Record("Carl Friedrich Gauss", "Universitaet Helmstedt",
@@ -49,61 +47,64 @@ class TestRecordMethods(unittest.TestCase):
self.assert_(record1 == record2)
def test007_cmp_unequal(self):
- # Verify two 'unequal' records are compared correctly.
+ """Verify two 'unequal' records are compared correctly."""
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.
+ """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.
+ """
+ Verify has_year() method returns True when the conditions are right.
+ """
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.
+ """
+ Verify has_year() method returns False when the conditions are right.
+ """
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.
+ """Test __unicode__() method for complete record."""
recstr = self.record.__unicode__()
recstrexpt = u"Carl Friedrich Gau\xdf \\nUniversit\xe4t Helmstedt \
(1799)"
self.assertEqual(recstr, recstrexpt)
def test013_unicode_no_year(self):
- # Test __unicode__() method for record without year.
+ """Test __unicode__() method for record without year."""
record = Record(self.record.name, self.record.institution, None, 18231)
recstr = record.__unicode__()
recstrexpt = u"Carl Friedrich Gau\xdf \\nUniversit\xe4t Helmstedt"
self.assertEqual(recstr, recstrexpt)
def test014_unicode_no_inst(self):
- # Test __unicode__() method for record without institution.
+ """Test __unicode__() method for record without institution."""
record = Record(self.record.name, None, 1799, 18231)
recstr = record.__unicode__()
recstrexpt = u"Carl Friedrich Gau\xdf \\n(1799)"
self.assertEqual(recstr, recstrexpt)
def test015_unicode_no_inst_no_id(self):
- # Test __unicode__() method for record without institution
- # or year.
+ """Test __unicode__() method for record without institution or year."""
record = Record(self.record.name, None, None, 18231)
recstr = record.__unicode__()
recstrexpt = u"Carl Friedrich Gau\xdf"
--
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