def __are_records_inconsistent(self, inconsistency_treated_as_error=False): inconsistent_records = DatabaseManager.get_any_inconsistent_records_with_annex( self.program_id, self.school.id, self.common_data.get_week_numbers()) if inconsistent_records: raise InconsistentAnnexWzError(inconsistent_records, inconsistency_treated_as_error)
def test_inconsistent_records(): weeks = set(x for x in range(1, 13)) assert (len(DatabaseManager.get_any_inconsistent_records_with_annex(5, 6, weeks)) == 1) assert (len(DatabaseManager.get_any_inconsistent_records_with_annex(5, 2, weeks)) == 0)