Skip to content

Commit

Permalink
Addressed testing and formatting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
FastLee committed Nov 9, 2023
1 parent d3d38a9 commit 575d624
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/databricks/labs/ucx/workspace_access/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def _crawl(self) -> list[WorkspaceObjectInfo]:
raw = obj.as_dict()
yield WorkspaceObjectInfo(
object_type=raw.get("object_type", None),
object_id=raw.get("object_id", None),
object_id=str(raw.get("object_id", None)),
path=raw.get("path", None),
language=raw.get("language", None),
)
Expand All @@ -310,7 +310,9 @@ def snapshot(self) -> list[WorkspaceObjectInfo]:

def _try_fetch(self) -> list[WorkspaceObjectInfo]:
for row in self._fetch(f"SELECT * FROM {self._schema}.{self._table}"):
yield WorkspaceObjectInfo(path=row["path"],object_type=row["object_type"],object_id=row["object_id"],language=row["language"])
yield WorkspaceObjectInfo(
path=row["path"], object_type=row["object_type"], object_id=row["object_id"], language=row["language"]
)

def object_types(self) -> set[str]:
return {"notebooks", "directories", "repos", "files"}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/workspace_access/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def test_workspaceobject_crawl():
result_set = list(crawler)

assert len(result_set) == 2
assert result_set[0] == WorkspaceObjectInfo( "/rootobj/notebook1", "NOTEBOOK", 123, "PYTHON")
assert result_set[0] == WorkspaceObjectInfo("/rootobj/notebook1", "NOTEBOOK", "123", "PYTHON")


def test_workspaceobject_withexperiment_crawl():
Expand All @@ -587,7 +587,7 @@ def test_workspaceobject_withexperiment_crawl():
result_set = list(crawler)

assert len(result_set) == 1
assert result_set[0] == WorkspaceObjectInfo("/rootobj/notebook1", "NOTEBOOK", 123, "PYTHON")
assert result_set[0] == WorkspaceObjectInfo("/rootobj/notebook1", "NOTEBOOK", "123", "PYTHON")


def test_workspace_snapshot():
Expand Down

0 comments on commit 575d624

Please sign in to comment.