From ed70aa0d74fc3b9c200486e95c3f2c66dc298510 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sat, 3 Jan 2015 09:15:58 -0500 Subject: [PATCH] Fix date_handler by renaming non-test methods; removed gedcom import tests that rely on old code, and didn't test much --- .../gen/datehandler/test/datehandler_test.py | 8 +- gramps/test/test/gedread_util_test.py | 81 ------------------- 2 files changed, 4 insertions(+), 85 deletions(-) delete mode 100644 gramps/test/test/gedread_util_test.py diff --git a/gramps/gen/datehandler/test/datehandler_test.py b/gramps/gen/datehandler/test/datehandler_test.py index 75a27d173..4d0ce845a 100644 --- a/gramps/gen/datehandler/test/datehandler_test.py +++ b/gramps/gen/datehandler/test/datehandler_test.py @@ -57,7 +57,7 @@ from .. import displayer as _dd # #------------------------------------------------------------------------- class DateHandlerTest(unittest.TestCase): - def base_test(self, test_date): + def base_case(self, test_date): datestr = _dd.display(test_date) new_date = _dp.parse(datestr) @@ -86,7 +86,7 @@ class DateHandlerTest(unittest.TestCase): dates.append(d) for test_date in dates: - self.base_test(test_date) + self.base_case(test_date) def test_span(self): @@ -125,7 +125,7 @@ class DateHandlerTest(unittest.TestCase): dates.append(d) for test_date in dates: - self.base_test(test_date) + self.base_case(test_date) def test_textual(self): calendar = Date.CAL_GREGORIAN @@ -135,7 +135,7 @@ class DateHandlerTest(unittest.TestCase): test_date = Date() test_date.set(quality, modifier, calendar, Date.EMPTY, "This is a textual date") - self.base_test(test_date) + self.base_case(test_date) def test_too_few_arguments(self): dateval = (4, 7, 1789, False) diff --git a/gramps/test/test/gedread_util_test.py b/gramps/test/test/gedread_util_test.py deleted file mode 100644 index bcb0ba330..000000000 --- a/gramps/test/test/gedread_util_test.py +++ /dev/null @@ -1,81 +0,0 @@ -# -# Gramps - a GTK+/GNOME based genealogy program -# -# Copyright (C) 2000-2007 Donald N. Allingham -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -# test/test/gedread_util_test.py - -"""test for test/gedread_util.py - -also illustrates basic use -""" - -import os -import unittest as U -import logging - -from test import test_util as tu -from test import gedread_util as gr - - -class Test(U.TestCase): - def setUp(self): - # make a dir to hold an input gedcom file - self.tdir = tu.make_subdir("gr_test") - - def test1(self): - prec=""" -0 @I1@ INDI -1 NAME GedRead TEST /Person/ -""" - - # create a gedcom input file - # from canned head/tail -- see gedread_util - infil = os.path.join(self.tdir,"test_in.ged") - gr.make_gedcom_input(infil, prec) - self.assertTrue(os.path.isfile(infil), - "create input file %s" % infil) - - # create an empty database - dbpath = os.path.join(self.tdir,"test_db") - db = gr.create_empty_db(dbpath) - self.assertTrue(os.path.isdir(dbpath), - "create database (dir) %s" % dbpath) - - # create logfile to test for read log-messages - # (note: uses recently added test_util - log = os.path.join(self.tdir, "test_log") - tl = tu.TestLogger() - tl.logfile_init(log) - # now read the gedcom - gr.gread(db, infil) - logging.warn("nothing here") - loglines = tl.logfile_getlines() - #NB incorrect SUBM handling causes one extraneous warning - xWarns = 1 - self.assertEquals(len(loglines),1 + xWarns, - "log has no unexpected content") - # verify one person in database - np = db.get_number_of_people() - self.assertEquals(np,1, - tu.msg(np,1, "db has exactly one person")) - db.close() - del tl - -if __name__ == "__main__": - U.main()