def test__validate_check_start__passes_expected_1_step(): """Confirms validator passes expected result with step = 1.""" try: validators.validate_checksum_start(12, 1) except ValidationError: assert False else: assert True
def clean(self): """Method to allow additional validation steps. :raises ValidationError: if start value is not a multiple of the step """ # Confirm a valid start and step are entered validate_checksum_start(self.drug_code_start, self.drug_code_step)
def test__validate_check_start__fails_100_step(): """Confirms validator fails with step = 100.""" try: validators.validate_checksum_start(122, 100) except ValidationError as e: assert 'Start values must be multiples of the step' in e.message assert '0, 100, 200, etc.' in e.message assert e.params == {'start': 122, 'step': 100} else: assert False