def from_json(cls, json): dbfs_path = DbfsPath.from_api_path(json['path']) # If JSON doesn't include modification_time data, replace it with None. modification_time = json[ 'modification_time'] if 'modification_time' in json else None return cls(dbfs_path, json['is_dir'], json['file_size'], modification_time)
def from_json(cls, json): dbfs_path = DbfsPath.from_api_path(json['path']) return cls(dbfs_path, json['is_dir'], json['file_size'])
def test_from_api_path_invalid(self): with mock.patch('databricks_cli.dbfs.dbfs_path.error_and_quit' ) as error_and_quit_mock: DbfsPath.from_api_path('dbfs:/test') assert error_and_quit_mock.call_count == 1 assert 'must start with' in error_and_quit_mock.call_args[0][0]
def test_from_api_path_valid(self): dbfs_path = DbfsPath.from_api_path('/test') assert dbfs_path == TEST_DBFS_PATH