Exemple #1
0
    def test_cc_itemfinder_valid(self):
        """cc_itemfinder: yield each expected block."""
        # pprint(list(cc_itemfinder(labeloff(cc_lines))))
        input_with_license = labeloff(cc_lines)
        self.assertEqual(len(list(cc_itemfinder(input_with_license))), 9)

        input_without_license = labeloff(cc_lines[:-4])
        self.assertEqual(len(list(cc_itemfinder(input_without_license))), 8)
Exemple #2
0
 def test_cc_itemfinder_raise(self):
     """cc_itemfinder: raise RecordError if license block bad."""
     input_with_license_lacking_bottom = labeloff(cc_lines[:-1])
     self.assertRaises(FieldError, cc_itemfinder,
                       input_with_license_lacking_bottom)
Exemple #3
0
 def test_labeloff(self):
     """labeloff: should return expected lines"""
     tests = ["AA   aa.", "BB    bb.", "CC C   cc.", "DD dd.", "EE", ""]
     # expects = [line[5:] for line in tests]
     expects = ["aa.", " bb.", "  cc.", ".", "", ""]
     self.assertEqual(labeloff(tests), expects)