def test_chamber(self): extention_content = cr_parser.parse_to_string('test/test_files/boiler_plate/CREC-2014-01-28-pt1-PgE123-4.txt', logdir="test/test_output", outdir="test/test_output") extention_content = str(extention_content) self.assertTrue("<chamber>Extensions</chamber>" in extention_content) self.assertTrue("<chamber>House</chamber>" in bolier_house_content) self.assertTrue("<chamber>Senate</chamber>" in bolier_senate_content)
def test_recorder(self): content = cr_parser.parse_to_string("test/test_files/names/CREC-2013-01-23-pt1-PgH225-7.txt", logdir="test/test_output", outdir="test/test_output") content = str(content) speaker = len(re.findall("<recorder>", content)) self.assertEqual(speaker, 1)
def test_presiding(self): content = cr_parser.parse_to_string("test/test_files/names/CREC-2013-01-23-pt1-PgS226-5.txt", logdir="test/test_output", outdir="test/test_output") content = str(content) speaker = len(re.findall('<speaker name="The PRESIDING OFFICER">', content)) speaking = len(re.findall('<speaking name="The PRESIDING OFFICER">', content)) self.assertEqual(speaker, 2) self.assertEqual(speaking, 3)
def test_acting_protemp(self): content = cr_parser.parse_to_string("test/test_files/names/CREC-2013-01-23-pt1-PgS189-5.txt", logdir="test/test_output", outdir="test/test_output") content = str(content) speaker = len(re.findall('<speaker name="The ACTING PRESIDENT pro tempore">', content)) speaking = len(re.findall('<speaking name="The ACTING PRESIDENT pro tempore">', content)) self.assertEqual(speaker, 1) self.assertEqual(speaking, 1)
def test_protempore(self): content = cr_parser.parse_to_string("test/test_files/names/CREC-2013-01-23-pt1-PgH251-2.txt", logdir="test/test_output", outdir="test/test_output") content = str(content) speaker = len(re.findall('<speaker name="The SPEAKER pro tempore">', content)) speaking = len(re.findall('<speaking name="The SPEAKER pro tempore">', content)) self.assertEqual(speaker, 1) self.assertEqual(speaking, 3)
def test_with_state(self): content = cr_parser.parse_to_string("test/test_files/names/CREC-2013-01-23-pt1-PgE53-4.txt", logdir="test/test_output", outdir="test/test_output") content = str(content) speaker = len(re.findall('<speaker name="Ms. SEWELL of Alabama">', content)) speaking = len(re.findall('<speaking name="Ms. SEWELL of Alabama">', content)) self.assertEqual(speaker, 1) self.assertEqual(speaking, 7)
def test_mrs(self): content = cr_parser.parse_to_string("test/test_files/names/CREC-2013-01-23-pt1-PgE53.txt", logdir="test/test_output", outdir="test/test_output") content = str(content) speaker = len(re.findall('<speaker name="Mrs. BUSTOS">', content)) speaking = len(re.findall('<speaking name="Mrs. BUSTOS">', content)) self.assertEqual(speaker, 1) self.assertEqual(speaking, 4)
def test_excutive(self): content = cr_parser.parse_to_string("test/test_files/SOTU/CREC-2014-01-28-pt1-PgH1473-5.txt", logdir="test/test_output", outdir="test/test_output") content = str(content) vpspeaker = len(re.findall('<speaker name="The VICE PRESIDENT"', content)) vpspeaking = len(re.findall('<speaking name="The VICE PRESIDENT"', content)) speaker = len(re.findall('<speaker name="The PRESIDENT"', content)) speaking = len(re.findall('<speaking name="The PRESIDENT"', content)) self.assertEqual(vpspeaker, 1) # the VP count is off # self.assertEqual(vpspeaking, 22) self.assertEqual(speaker, 1) self.assertEqual(speaking, 105)
def bolier_house_content(): house_content = cr_parser.parse_to_string("test/test_files/boiler_plate/CREC-2014-01-28-pt1-PgH1433-2.txt", logdir="test/test_output", outdir="test/test_output") return str(house_content)
def test_block_quote(self): content = cr_parser.parse_to_string('test/test_files/common_tags/CREC-2013-01-23-pt1-PgE58-3.txt', logdir="test/test_output", outdir="test/test_output") content = str(content) self.assertTrue('<speaking quote="true" speaker="Mr. SABLAN">' in content)