def test_empty_threshold_not_valid(): """ (Regression) Verifies that empty string is not valid for threshold """ badjson_tempfile = _modify_json_with( 'testdata/inputs/universal-tabulator/one-round.json', lambda d: d['config'].update({'threshold': ''})) schema = universaltabulator.SchemaV0() assert not schema.validate(badjson_tempfile.name)
def test_threshold_is_optional(): """ Verifies that threshold may be nonexistent """ badjson_tempfile = _modify_json_with( 'testdata/inputs/universal-tabulator/one-round.json', lambda d: d['config'].pop('threshold')) schema = universaltabulator.SchemaV0() assert schema.validate(badjson_tempfile.name)
def test_can_pass_raw_json(): """ Verifies that raw JSON data can be passed: filelike objects or filenames are not mandatory """ filename = 'testdata/inputs/universal-tabulator/one-round.json' with open(filename, 'r', encoding='utf-8') as fileobj: data = json.load(fileobj) schema = universaltabulator.SchemaV0() assert schema.validate(data)
def __init__(self): """ Initializes common data """ self.ut_schema = universaltabulator.SchemaV0()
def test_universal_tabulator_formats_valid(): """ Verifies that the example formats are valid """ schema = universaltabulator.SchemaV0() _validate_files_in_dir_with('testdata/inputs/universal-tabulator', schema)