class GedcomParserTestCase(TestCase):

	def setUp(self):
		self.parser = GedcomParser()

	def test_fileContentHasNoHead_exceptionThrown(self):
		
		fileContent = "1 INDI"

		with self.assertRaises(InvalidFileException) as contextManager:
			self.parser.parseGedcomContent(fileContent)

		exception = contextManager.exception
		self.assertEqual(str(exception), "The file has no HEAD")

	def test_fileHasPerson_PersonCreated(self):
		fileContent = "0 HEAD"
		fileContent = fileContent + " \n 0 @I1@ INDI"
		fileContent = fileContent + " \n 1 NAME Patrick"
		fileContent = fileContent + " \n 0 TRLR"
		
		people = self.parser.parseGedcomContent(fileContent)

		self.assertIsNotNone(people)
		self.assertEqual(people[0].name, "Patrick")
Exemple #2
0
class GedcomParserTestCase(TestCase):
    def setUp(self):
        self.parser = GedcomParser()

    def test_fileContentHasNoHead_exceptionThrown(self):

        fileContent = "1 INDI"

        with self.assertRaises(InvalidFileException) as contextManager:
            self.parser.parseGedcomContent(fileContent)

        exception = contextManager.exception
        self.assertEqual(str(exception), "The file has no HEAD")

    def test_fileHasPerson_PersonCreated(self):
        fileContent = "0 HEAD"
        fileContent = fileContent + " \n 0 @I1@ INDI"
        fileContent = fileContent + " \n 1 NAME Patrick"
        fileContent = fileContent + " \n 0 TRLR"

        people = self.parser.parseGedcomContent(fileContent)

        self.assertIsNotNone(people)
        self.assertEqual(people[0].name, "Patrick")
Exemple #3
0
 def setUp(self):
     self.parser = GedcomParser()
	def setUp(self):
		self.parser = GedcomParser()