diff --git a/frictionless/resource/__spec__/test_datatype.py b/frictionless/resource/__spec__/test_datatype.py index 9315e33971..509b358bc2 100644 --- a/frictionless/resource/__spec__/test_datatype.py +++ b/frictionless/resource/__spec__/test_datatype.py @@ -173,7 +173,6 @@ def test_resource_from_descriptor_with_class_datatype(): ) def test_schema_resource_with_path_property(source): schema = Schema(source) - print(source) resource = Resource(schema.to_descriptor(), datatype="schema") assert resource.type == "json" assert resource.datatype == "schema" diff --git a/frictionless/resource/factory.py b/frictionless/resource/factory.py index 82472c9c2d..a2dcc798e8 100644 --- a/frictionless/resource/factory.py +++ b/frictionless/resource/factory.py @@ -45,16 +45,16 @@ def __call__( path = source if isinstance(source, str): path = helpers.join_basepath(source, basepath=basepath) + md_type = options.get("datatype") if not md_type: md_type = Detector.detect_metadata_type( path, format=options.get("format") ) + if md_type != "resource": options["path" if isinstance(source, str) else "data"] = source - resource = cls( # type: ignore - control=control, basepath=basepath, **options - ) + resource = cls(control=control, basepath=basepath, **options) # type: ignore return cast(T, resource) # Descriptor