def test_write_load_schema_text(self): schema = text_format.Parse( """ feature { name: "feature1" } feature { name: "feature2" } """, schema_pb2.Schema()) schema_path = os.path.join(FLAGS.test_tmpdir, 'schema.pbtxt') schema_util.write_schema_text(schema=schema, output_path=schema_path) loaded_schema = schema_util.load_schema_text(input_path=schema_path) self.assertEqual(schema, loaded_schema)
def test_write_schema_text_invalid_schema_input(self): with self.assertRaisesRegexp(TypeError, 'should be a Schema proto'): _ = schema_util.write_schema_text({}, 'schema.pbtxt')