[geneagrapher] 158/226: Removed the Grabber.get_page method.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sat Jul 11 17:10:58 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 d27c555fe87e7b9a4b106d339eea5a6d72fb1b37
Author: David Alber <alber.david at gmail.com>
Date:   Mon Oct 31 21:26:40 2011 -0700

    Removed the Grabber.get_page method.
---
 geneagrapher/grabber.py       | 10 ++--------
 tests/test_grabber_methods.py | 22 ++++++++--------------
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/geneagrapher/grabber.py b/geneagrapher/grabber.py
index 1412f56..4737f5d 100644
--- a/geneagrapher/grabber.py
+++ b/geneagrapher/grabber.py
@@ -15,13 +15,6 @@ class Grabber:
         self.advisors = []
         self.descendants = []
 
-    def get_page(self):
-        """
-        Grab the page for self.id from the Math Genealogy Database.
-        """
-        url = 'http://genealogy.math.ndsu.nodak.edu/id.php?id=' + str(self.id)
-        return urllib.urlopen(url)
-
     @staticmethod
     def extract_id(tag):
         """Extract the ID from a tag with form <a href="id.php?id=7401">."""
@@ -33,7 +26,8 @@ class Grabber:
         advisor ids, the mathematician name, the mathematician
         institution, and the year of the mathematician's degree.
         """
-        page = self.get_page()
+        url = 'http://genealogy.math.ndsu.nodak.edu/id.php?id=' + str(self.id)
+        page = urllib.urlopen(url)
         soup = BeautifulSoup(page, convertEntities='html')
         page.close()
             
diff --git a/tests/test_grabber_methods.py b/tests/test_grabber_methods.py
index 77eafa2..64121fc 100644
--- a/tests/test_grabber_methods.py
+++ b/tests/test_grabber_methods.py
@@ -17,18 +17,12 @@ class TestGrabberMethods(unittest.TestCase):
         self.assertEquals(self.grabber.advisors, [])
         self.assertEquals(self.grabber.descendants, [])
 
-    def test002_get_page(self):
-        # Test get_page() method.
-        page = self.grabber.get_page()
-        pagestr = page.read()
-        self.assert_("<title>The Mathematics Genealogy Project - Carl Gau" in pagestr)
-
-    def test003_extract_info_bad(self):
+    def test002_extract_info_bad(self):
         # Verify exception thrown for bad id.
         grabber = Grabber(999999999)
         self.assertRaises(ValueError, grabber.extract_node_information)
         
-    def test004_extract_info_all_fields(self):
+    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()
         self.assertEquals(name, self.grabber.name)
@@ -49,7 +43,7 @@ class TestGrabberMethods(unittest.TestCase):
         self.assertEquals(advisors, [18230])
         self.assertEquals(descendents, [18603, 18233, 62547, 29642, 55175, 29458, 19953, 18232, 151876])
         
-    def test005_extract_info_no_advisor(self):
+    def test004_extract_info_no_advisor(self):
         # Test the extract_node_information() method for a record with no advisor.
         grabber = Grabber(137717)
         [name, institution, year, advisors, descendents] = grabber.extract_node_information()
@@ -59,7 +53,7 @@ class TestGrabberMethods(unittest.TestCase):
         self.assertEquals(advisors, [])
         self.assertEquals(descendents, [127946])
         
-    def test006_extract_info_no_descendants(self):
+    def test005_extract_info_no_descendants(self):
         # Test the extract_node_information() method for a record with no
         # descendants.
 
@@ -72,7 +66,7 @@ class TestGrabberMethods(unittest.TestCase):
         self.assertEquals(advisors, [51261])
         self.assertEquals(descendents, [])
 
-    def test007_extract_info_no_year(self):
+    def test006_extract_info_no_year(self):
         # Test the extract_node_information() method for a record with no year.
         # This example also has no descendents.
         grabber = Grabber(53658)
@@ -83,7 +77,7 @@ class TestGrabberMethods(unittest.TestCase):
         self.assertEquals(advisors, [51261])
         self.assertEquals(descendents, [])
         
-    def test008_extract_info_no_inst(self):
+    def test007_extract_info_no_inst(self):
         # Test the extract_node_information() method for a record with no institution.
         # This test is also missing additional information already tested.
         grabber = Grabber(52965)
@@ -95,7 +89,7 @@ class TestGrabberMethods(unittest.TestCase):
         self.assertEquals(descendents, [52996])
 
     # Tests for special (from my point of view) characters:
-    def test009_slash_l(self):
+    def test008_slash_l(self):
         # 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.
@@ -106,7 +100,7 @@ class TestGrabberMethods(unittest.TestCase):
         self.assertEquals(year, 1911)
         self.assertEquals(advisors, [7298])
 
-    def test010_multiple_advisors(self):
+    def test009_multiple_advisors(self):
         # Test for multiple advisors.
         grabber = Grabber(19964)
         [name, institution, year, advisors, descendents] = grabber.extract_node_information()

-- 
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