def test_003_parse_name_myher(self): """Test parse_name_myher() """ rec = model.NameRec() rec.level = 1 rec.tag = "NAME" rec.dialect = model.DIALECT_MYHERITAGE rec.value = "First /Last Name/ Second" name_tup = parse_name_myher(rec) self.assertIsInstance(name_tup, tuple) self.assertEqual(name_tup, ("First", "Last Name", "Second")) rec.value = "First /Last(-er)/ Second" name_tup = parse_name_myher(rec) self.assertIsInstance(name_tup, tuple) self.assertEqual(name_tup, ("First", "Last(-er)", "Second")) rec.value = "First /Last (-er)/ Second" name_tup = parse_name_altree(rec) self.assertIsInstance(name_tup, tuple) self.assertEqual(name_tup, ("First", "Last (-er)", "Second")) married = model.Record() married.level = 2 married.tag = "_MARNM" married.value = "Married" rec.value = "First /Maiden/" rec.sub_records = [married] name_tup = parse_name_myher(rec) self.assertIsInstance(name_tup, tuple) self.assertEqual(name_tup, ("First", "Married", "", "Maiden"))
def test_002_parse_name_altree(self): """Test parse_name_altree() """ rec = model.NameRec() rec.level = 1 rec.tag = "NAME" rec.dialect = model.DIALECT_ALTREE rec.value = "First /Last Name/ Second" name_tup = parse_name_altree(rec) self.assertIsInstance(name_tup, tuple) self.assertEqual(name_tup, ("First", "Last Name", "Second")) rec.value = "First /Last(-er)/ Second" name_tup = parse_name_altree(rec) self.assertIsInstance(name_tup, tuple) self.assertEqual(name_tup, ("First", "Last(-er)", "Second")) rec.value = "First /Last (-er)/ Second" name_tup = parse_name_altree(rec) self.assertIsInstance(name_tup, tuple) self.assertEqual(name_tup, ("First", "Last (-er)", "Second")) maiden = model.Record() maiden.level = 2 maiden.tag = "SURN" maiden.value = "Maiden" rec.value = "First /Last (Maiden)/" rec.sub_records = [maiden] name_tup = parse_name_altree(rec) self.assertIsInstance(name_tup, tuple) self.assertEqual(name_tup, ("First", "Last", "", "Maiden"))
def test_012_namerec_myher(self): """Test NameRec class with MYHERITAGE dialect.""" rec = model.NameRec() rec.level = 1 rec.tag = "NAME" rec.dialect = model.DIALECT_MYHERITAGE rec.sub_records = [] rec.value = "" rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("", "", "")) rec.value = None rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("", "", "")) rec.value = "First /Last Name/ Second " rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("First", "Last Name", "Second")) married = model.Record() married.level = 2 married.tag = "_MARNM" married.value = "Last" married.sub_records = [] rec.value = "First /Maiden/" rec.sub_records = [married] rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("First", "Last", "", "Maiden"))
def test_011_namerec_altree(self): """Test NameRec class with ALTREE dialect.""" rec = model.NameRec() rec.level = 1 rec.tag = "NAME" rec.dialect = model.DIALECT_ALTREE rec.value = "" rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("", "", "")) rec.value = None rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("", "", "")) rec.value = "First /Last Name/ Second " rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("First", "Last Name", "Second")) maiden = model.Record() maiden.level = 2 maiden.tag = "SURN" maiden.value = "Maiden" rec.value = "First /Last (Maiden)/" rec.sub_records = [maiden] rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("First", "Last", "", "Maiden"))
def test_004_parse_name_ancestris(self): """Test parse_name_ancestris() Ancestris dialect is just a split_name() which is tested separately, so the is not much testing needed for it. """ rec = model.NameRec() rec.level = 1 rec.tag = "NAME" rec.dialect = model.DIALECT_ANCESTRIS rec.value = "First /Last Name/ Second" name_tup = parse_name_ancestris(rec) self.assertIsInstance(name_tup, tuple) self.assertEqual(name_tup, ("First", "Last Name", "Second")) rec.value = "First /Last(-er)/ Second" name_tup = parse_name_ancestris(rec) self.assertIsInstance(name_tup, tuple) self.assertEqual(name_tup, ("First", "Last(-er)", "Second")) rec.value = "First /Last (-er)/ Second" name_tup = parse_name_ancestris(rec) self.assertIsInstance(name_tup, tuple) self.assertEqual(name_tup, ("First", "Last (-er)", "Second"))
def test_010_namerec_default(self): """Test NameRec class with default dialect.""" rec = model.NameRec() rec.level = 1 rec.tag = "NAME" rec.dialect = model.DIALECT_DEFAULT rec.value = "" rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("", "", "")) rec.value = None rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("", "", "")) rec.value = "First Name" rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("First Name", "", "")) rec.value = " /Last Name/ " rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("", "Last Name", "")) rec.value = " /Last Name" rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("", "Last Name", "")) rec.value = "First /Last Name/ " rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("First", "Last Name", "")) rec.value = "First /Last Name/ Second " rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("First", "Last Name", "Second")) rec.value = "First /Last (Maiden)/" rec.freeze() self.assertIsInstance(rec.value, tuple) self.assertEqual(rec.value, ("First", "Last (Maiden)", ""))