def generate_types_from_schemas(): for schema_file_path in schema_file_paths: python_contents = typed_dict_from_schema_file(schema_file_path) schema_name = schema_name_from_path(schema_file_path) type_file_name = f"{types_directory}/{schema_name}.py" with open(type_file_name, "w+") as f: f.write(python_contents)
def test_snapshot_schema_references(self): references = [ "tests/test_shopping_cart/com.wave.Product.avsc", "tests/test_shopping_cart/com.wave.OrderDetail.avsc", ] test_schema_file = "tests/test_shopping_cart/com.wave.Order.avsc" test_output = typed_dict_from_schema_file(test_schema_file, references) schema_name = test_schema_file.rsplit("/", 1)[-1] self.assertMatchSnapshot(test_output, schema_name)
def test_snapshot_expandable_schemas(self): for test_schema_file in expandable_schema_files: test_output = typed_dict_from_schema_file(test_schema_file) schema_name = test_schema_file.rsplit("/", 1)[-1] self.assertMatchSnapshot(test_output, schema_name)
def test_array_map_schemas(self): for test_schema_file in handshake_files: test_output = typed_dict_from_schema_file(test_schema_file) schema_name = test_schema_file.rsplit("/", 1)[-1] self.assertMatchSnapshot(test_output, schema_name)