def test_should_error_out_with_malformed_input_to_parse_and_validate(): v = framecurve.validate(StringIO("foobar")) assert len(v.errors) == 1 print "errors", v.errors print "warnings", v.warnings assert v.errors == ["Malformed line 1: 'foobar'"]
def load_and_validate_stream(fc_stream): parsed_curve = framecurve.parse(fc_stream) validator = framecurve.validate(curve=parsed_curve) if not validator.ok: raise Exception("The framecurve file had problems: " + "\n".join(validator.errors)) return parsed_curve
def test_should_not_error_out_with_good_input_to_parse_and_validate(): io = StringIO("# Nice framecurve\r\n1\t146.0") v = framecurve.validate(io) print "errors", v.errors print "warnings", v.warnings assert len(v.errors) == 0