def test_split_s3_path(self): # Test splitting good urls. assert split_s3_path("s3://my-bucket/subdir/file.txt") == ("my-bucket", "subdir/file.txt") assert split_s3_path("s3://my-bucket/file.txt") == ("my-bucket", "file.txt") # Test splitting bad urls. with pytest.raises(ValueError): split_s3_path("s3://") split_s3_path("s3://myfile.txt") split_s3_path("myfile.txt")
def test_split_s3_path(self): # Test splitting good urls. assert split_s3_path("s3://my-bucket/subdir/file.txt") == ("my-bucket", "subdir/file.txt") assert split_s3_path("s3://my-bucket/file.txt") == ("my-bucket", "file.txt") # Test splitting bad urls. with pytest.raises(ValueError): split_s3_path("s3://") split_s3_path("s3://myfile.txt") split_s3_path("myfile.txt")
def get_file_info(url): bucket_name, s3_path = split_s3_path(url) return s3_resource.Object(bucket_name, s3_path).content_type
def get_file_info(url): bucket_name, s3_path = split_s3_path(url) return s3_resource.Object(bucket_name, s3_path).content_type