Example #1
0
    def get_plan_defaults_from_row(self, row):
        (start_year,
         end_year) = PlanDocument.start_and_end_year_from_time_period(
             row["time_period"])
        defaults = {
            "document_type": PlanDocument.document_type_code(row["type"]),
            "scope": PlanDocument.scope_code(row["scope"]),
            "status": PlanDocument.status_code(row["status"]),
            "well_presented": boolean_from_text(row["well_presented"]),
            "baseline_analysis": boolean_from_text(row["baseline_analysis"]),
            "notes": char_from_text(row["notes"]),
            "file_type": char_from_text(row["file_type"]),
            "charset": char_from_text(row["charset"]),
            "text": char_from_text(row["text"]),
            "start_year": start_year,
            "end_year": end_year,
            "date_last_found": date_from_text(row["date_retrieved"]),
            "title": "",
        }
        if char_from_text(row["title_checked"]).lower() == "y":
            defaults["title"] = char_from_text(row["title"])

        return defaults
Example #2
0
 def test_capitalisation(self):
     expected = True
     actual = boolean_from_text("y")
     self.assertEqual(expected, actual)
Example #3
0
 def test_invalid_entry(self):
     expected = None
     actual = boolean_from_text("yawp")
     self.assertEqual(expected, actual)
Example #4
0
 def test_simple_case(self):
     expected = False
     actual = boolean_from_text("N")
     self.assertEqual(expected, actual)
Example #5
0
 def test_yes_no(self):
     expected = True
     actual = boolean_from_text("yes")
     self.assertEqual(expected, actual)