Skip to content

Commit 218a73a

Browse files
committed
run black on new files
1 parent 8e74cb5 commit 218a73a

File tree

3 files changed

+71
-49
lines changed

3 files changed

+71
-49
lines changed

dialogflow/cloud-client/create_session_entity_type_test.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222

2323
import session_entity_type_management
2424

25-
PROJECT_ID = os.getenv('GCLOUD_PROJECT')
26-
SESSION_ID = 'session_' + datetime.datetime.now().strftime("%Y%m%d%H%M%S")
27-
ENTITY_TYPE_DISPLAY_NAME = 'test_type_' \
28-
+ datetime.datetime.now().strftime("%Y%m%d%H%M%S")
29-
ENTITY_VALUES = ['fake_entity_value_1', 'fake_entity_value_2']
25+
PROJECT_ID = os.getenv("GCLOUD_PROJECT")
26+
SESSION_ID = "session_" + datetime.datetime.now().strftime("%Y%m%d%H%M%S")
27+
ENTITY_TYPE_DISPLAY_NAME = "test_type_" + datetime.datetime.now().strftime(
28+
"%Y%m%d%H%M%S"
29+
)
30+
ENTITY_VALUES = ["fake_entity_value_1", "fake_entity_value_2"]
3031

3132

3233
@pytest.fixture(scope="function", autouse=True)
@@ -36,23 +37,29 @@ def setup_teardown():
3637
parent = entity_types_client.project_agent_path(PROJECT_ID)
3738
entity_type = dialogflow.types.EntityType(
3839
display_name=ENTITY_TYPE_DISPLAY_NAME,
39-
kind=dialogflow.enums.EntityType.Kind.KIND_MAP)
40+
kind=dialogflow.enums.EntityType.Kind.KIND_MAP,
41+
)
4042

4143
response = entity_types_client.create_entity_type(parent, entity_type)
42-
entity_type_id = response.name.split('agent/entityTypes/')[1]
44+
entity_type_id = response.name.split("agent/entityTypes/")[1]
4345

4446
yield
4547

4648
# Delete the created entity type
4749
entity_type_path = entity_types_client.entity_type_path(
48-
PROJECT_ID, entity_type_id)
50+
PROJECT_ID, entity_type_id
51+
)
4952
entity_types_client.delete_entity_type(entity_type_path)
5053

5154

5255
def test_create_session_entity_type(capsys):
5356
session_entity_type_management.create_session_entity_type(
54-
PROJECT_ID, SESSION_ID, ENTITY_VALUES, ENTITY_TYPE_DISPLAY_NAME,
55-
'ENTITY_OVERRIDE_MODE_SUPPLEMENT')
57+
PROJECT_ID,
58+
SESSION_ID,
59+
ENTITY_VALUES,
60+
ENTITY_TYPE_DISPLAY_NAME,
61+
"ENTITY_OVERRIDE_MODE_SUPPLEMENT",
62+
)
5663

5764
out, _ = capsys.readouterr()
5865

dialogflow/cloud-client/delete_session_entity_type_test.py

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222

2323
import session_entity_type_management
2424

25-
PROJECT_ID = os.getenv('GCLOUD_PROJECT')
26-
SESSION_ID = 'session_' + datetime.datetime.now().strftime("%Y%m%d%H%M%S")
27-
ENTITY_TYPE_DISPLAY_NAME = 'session_type_' \
28-
+ datetime.datetime.now().strftime("%Y%m%d%H%M%S")
29-
ENTITY_VALUES = ['fake_entity_value_1', 'fake_entity_value_2']
25+
PROJECT_ID = os.getenv("GCLOUD_PROJECT")
26+
SESSION_ID = "session_" + datetime.datetime.now().strftime("%Y%m%d%H%M%S")
27+
ENTITY_TYPE_DISPLAY_NAME = "session_type_" + datetime.datetime.now().strftime(
28+
"%Y%m%d%H%M%S"
29+
)
30+
ENTITY_VALUES = ["fake_entity_value_1", "fake_entity_value_2"]
3031
pytest.ENTITY_TYPE_ID = None
3132

3233

@@ -37,42 +38,49 @@ def setup():
3738
parent = entity_types_client.project_agent_path(PROJECT_ID)
3839
entity_type = dialogflow.types.EntityType(
3940
display_name=ENTITY_TYPE_DISPLAY_NAME,
40-
kind=dialogflow.enums.EntityType.Kind.KIND_MAP)
41+
kind=dialogflow.enums.EntityType.Kind.KIND_MAP,
42+
)
4143

4244
response = entity_types_client.create_entity_type(parent, entity_type)
43-
entity_type_id = response.name.split('agent/entityTypes/')[1]
45+
entity_type_id = response.name.split("agent/entityTypes/")[1]
4446

4547
# Create a session entity type
4648
session_entity_types_client = dialogflow.SessionEntityTypesClient()
4749
session_path = session_entity_types_client.session_path(
48-
PROJECT_ID, SESSION_ID)
49-
session_entity_type_name = (
50-
session_entity_types_client.session_entity_type_path(
51-
PROJECT_ID, SESSION_ID, ENTITY_TYPE_DISPLAY_NAME))
50+
PROJECT_ID, SESSION_ID
51+
)
52+
session_entity_type_name = session_entity_types_client.session_entity_type_path(
53+
PROJECT_ID, SESSION_ID, ENTITY_TYPE_DISPLAY_NAME
54+
)
5255
entities = [
5356
dialogflow.types.EntityType.Entity(value=value, synonyms=[value])
54-
for value in ENTITY_VALUES]
57+
for value in ENTITY_VALUES
58+
]
5559
session_entity_type = dialogflow.types.SessionEntityType(
5660
name=session_entity_type_name,
57-
entity_override_mode='ENTITY_OVERRIDE_MODE_OVERRIDE',
58-
entities=entities)
61+
entity_override_mode="ENTITY_OVERRIDE_MODE_OVERRIDE",
62+
entities=entities,
63+
)
5964
session_entity_types_client.create_session_entity_type(
60-
session_path, session_entity_type)
65+
session_path, session_entity_type
66+
)
6167

6268
yield
6369

6470
# Delete the created entity type
6571
entity_type_path = entity_types_client.entity_type_path(
66-
PROJECT_ID, entity_type_id)
72+
PROJECT_ID, entity_type_id
73+
)
6774
entity_types_client.delete_entity_type(entity_type_path)
6875

6976

7077
def test_delete_session_entity_type(capsys):
7178
session_entity_type_management.delete_session_entity_type(
72-
PROJECT_ID, SESSION_ID, ENTITY_TYPE_DISPLAY_NAME)
79+
PROJECT_ID, SESSION_ID, ENTITY_TYPE_DISPLAY_NAME
80+
)
7381

74-
session_entity_type_management.list_session_entity_types(PROJECT_ID,
75-
SESSION_ID)
82+
session_entity_type_management.list_session_entity_types(
83+
PROJECT_ID, SESSION_ID
84+
)
7685
out, _ = capsys.readouterr()
7786
assert ENTITY_TYPE_DISPLAY_NAME not in out
78-

dialogflow/cloud-client/list_session_entity_types_test.py

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222

2323
import session_entity_type_management
2424

25-
PROJECT_ID = os.getenv('GCLOUD_PROJECT')
26-
SESSION_ID = 'session_' + datetime.datetime.now().strftime("%Y%m%d%H%M%S")
27-
ENTITY_TYPE_DISPLAY_NAME = 'session_type_' \
28-
+ datetime.datetime.now().strftime("%Y%m%d%H%M%S")
29-
ENTITY_VALUES = ['fake_entity_value_1', 'fake_entity_value_2']
25+
PROJECT_ID = os.getenv("GCLOUD_PROJECT")
26+
SESSION_ID = "session_" + datetime.datetime.now().strftime("%Y%m%d%H%M%S")
27+
ENTITY_TYPE_DISPLAY_NAME = "session_type_" + datetime.datetime.now().strftime(
28+
"%Y%m%d%H%M%S"
29+
)
30+
ENTITY_VALUES = ["fake_entity_value_1", "fake_entity_value_2"]
3031
pytest.ENTITY_TYPE_ID = None
3132

3233

@@ -37,39 +38,45 @@ def setup():
3738
parent = entity_types_client.project_agent_path(PROJECT_ID)
3839
entity_type = dialogflow.types.EntityType(
3940
display_name=ENTITY_TYPE_DISPLAY_NAME,
40-
kind=dialogflow.enums.EntityType.Kind.KIND_MAP)
41+
kind=dialogflow.enums.EntityType.Kind.KIND_MAP,
42+
)
4143

4244
response = entity_types_client.create_entity_type(parent, entity_type)
43-
entity_type_id = response.name.split('agent/entityTypes/')[1]
45+
entity_type_id = response.name.split("agent/entityTypes/")[1]
4446

4547
# Create a session entity type
4648
session_entity_types_client = dialogflow.SessionEntityTypesClient()
4749
session_path = session_entity_types_client.session_path(
48-
PROJECT_ID, SESSION_ID)
49-
session_entity_type_name = (
50-
session_entity_types_client.session_entity_type_path(
51-
PROJECT_ID, SESSION_ID, ENTITY_TYPE_DISPLAY_NAME))
50+
PROJECT_ID, SESSION_ID
51+
)
52+
session_entity_type_name = session_entity_types_client.session_entity_type_path(
53+
PROJECT_ID, SESSION_ID, ENTITY_TYPE_DISPLAY_NAME
54+
)
5255
entities = [
5356
dialogflow.types.EntityType.Entity(value=value, synonyms=[value])
54-
for value in ENTITY_VALUES]
57+
for value in ENTITY_VALUES
58+
]
5559
session_entity_type = dialogflow.types.SessionEntityType(
5660
name=session_entity_type_name,
57-
entity_override_mode='ENTITY_OVERRIDE_MODE_OVERRIDE',
58-
entities=entities)
61+
entity_override_mode="ENTITY_OVERRIDE_MODE_OVERRIDE",
62+
entities=entities,
63+
)
5964
session_entity_types_client.create_session_entity_type(
60-
session_path, session_entity_type)
65+
session_path, session_entity_type
66+
)
6167

6268
yield
6369

6470
# Delete the created entity type
6571
entity_type_path = entity_types_client.entity_type_path(
66-
PROJECT_ID, entity_type_id)
72+
PROJECT_ID, entity_type_id
73+
)
6774
entity_types_client.delete_entity_type(entity_type_path)
6875

6976

7077
def test_list_session_entity_types(capsys):
71-
session_entity_type_management.list_session_entity_types(PROJECT_ID,
72-
SESSION_ID)
78+
session_entity_type_management.list_session_entity_types(
79+
PROJECT_ID, SESSION_ID
80+
)
7381
out, _ = capsys.readouterr()
7482
assert ENTITY_TYPE_DISPLAY_NAME in out
75-

0 commit comments

Comments
 (0)