def testReadandValidateSchemaFromFile(self):
    infile = os.path.join(self.dirname, 'test_schema_file')
    f = open(infile, 'wt')
    f.write(test_util.GetCarsSchemaString())
    f.close()
    read_schema = load_lib.ReadSchemaFile(infile)
    load_lib._ValidateExtendedSchema(read_schema)
    expected_schema = json.loads(test_util.GetCarsSchemaString())
    self.assertEquals(expected_schema, read_schema)
    # append some non-json text and check failure.
    f = open(infile, 'at')
    f.write('bogus')
    f.close()
    try:
      load_lib.ReadSchemaFile(infile)
      self.fail()
    except __HOLE__:
      pass  # success
dataset/ETHPy150Open google/encrypted-bigquery-client/src/load_lib_test.py/LoadLibraryTest.testReadandValidateSchemaFromFile