Skip to content

Commit 3e5bae9

Browse files
chore: use python-samples-reviewers (#278)
1 parent 817486e commit 3e5bae9

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

datacatalog/snippets/conftest.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,18 @@ def policy_tag_manager_client(credentials):
133133
@pytest.fixture
134134
def random_taxonomy_display_name(policy_tag_manager_client, project_id):
135135
now = datetime.datetime.now()
136-
random_display_name = f'example_taxonomy' \
137-
f'_{now.strftime("%Y%m%d%H%M%S")}' \
138-
f'_{uuid.uuid4().hex[:8]}'
136+
random_display_name = (
137+
f"example_taxonomy"
138+
f'_{now.strftime("%Y%m%d%H%M%S")}'
139+
f"_{uuid.uuid4().hex[:8]}"
140+
)
139141
yield random_display_name
140142
parent = datacatalog_v1.PolicyTagManagerClient.common_location_path(
141-
project_id, 'us'
143+
project_id, "us"
142144
)
143145
taxonomies = policy_tag_manager_client.list_taxonomies(parent=parent)
144146
taxonomy = next(
145-
(t for t in taxonomies if t.display_name == random_display_name), None)
147+
(t for t in taxonomies if t.display_name == random_display_name), None
148+
)
146149
if taxonomy:
147150
policy_tag_manager_client.delete_taxonomy(name=taxonomy.name)

datacatalog/snippets/data_catalog_ptm_create_taxonomy.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ def create_taxonomy(
2020
# TODO(developer): Set project_id to the ID of the project the
2121
# taxonomy will belong to.
2222
project_id: str = "your-project-id",
23-
2423
# TODO(developer): Specify the geographic location where the
2524
# taxonomy should reside.
2625
location_id: str = "us",
27-
2826
# TODO(developer): Set the display name of the taxonomy.
2927
display_name: str = "example-taxonomy",
3028
):
@@ -41,10 +39,11 @@ def create_taxonomy(
4139
# TODO(developer): Construct a full Taxonomy object to send to the API.
4240
taxonomy = datacatalog_v1.Taxonomy()
4341
taxonomy.display_name = display_name
44-
taxonomy.description = 'This Taxonomy represents ...'
42+
taxonomy.description = "This Taxonomy represents ..."
4543

4644
# Send the taxonomy to the API for creation.
4745
taxonomy = client.create_taxonomy(parent=parent, taxonomy=taxonomy)
48-
print(f'Created taxonomy {taxonomy.name}')
46+
print(f"Created taxonomy {taxonomy.name}")
47+
4948

5049
# [END data_catalog_ptm_create_taxonomy]

datacatalog/snippets/data_catalog_ptm_create_taxonomy_test.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616
import data_catalog_ptm_create_taxonomy
1717

1818

19-
def test_create_taxonomy(capsys,
20-
project_id: str,
21-
random_taxonomy_display_name: str):
19+
def test_create_taxonomy(capsys, project_id: str, random_taxonomy_display_name: str):
2220

2321
data_catalog_ptm_create_taxonomy.create_taxonomy(
24-
project_id=project_id, location_id="us", display_name=random_taxonomy_display_name)
25-
out, _ = capsys.readouterr()
26-
assert (
27-
f'Created taxonomy projects/{project_id}/locations/us/taxonomies/'
28-
in out
22+
project_id=project_id,
23+
location_id="us",
24+
display_name=random_taxonomy_display_name,
2925
)
26+
out, _ = capsys.readouterr()
27+
assert f"Created taxonomy projects/{project_id}/locations/us/taxonomies/" in out

0 commit comments

Comments
 (0)