Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5a37c65

Browse filesBrowse files
nnegreyleahecole
andauthored
langauge: fix old automl tests (GoogleCloudPlatform#3089)
Co-authored-by: Leah E. Cole <6719667+leahecole@users.noreply.github.com>
1 parent 374b8bb commit 5a37c65
Copy full SHA for 5a37c65

File tree

Expand file treeCollapse file tree

1 file changed

+22
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+22
-8
lines changed

‎language/automl/dataset_test.py

Copy file name to clipboardExpand all lines: language/automl/dataset_test.py
+22-8Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,7 @@ def test_dataset_create_import_delete(capsys):
3535
out, _ = capsys.readouterr()
3636
create_dataset_output = out.splitlines()
3737
assert "Dataset id: " in create_dataset_output[1]
38-
39-
# import data
4038
dataset_id = create_dataset_output[1].split()[2]
41-
data = "gs://{}-lcm/happiness.csv".format(project_id)
42-
automl_natural_language_dataset.import_data(
43-
project_id, compute_region, dataset_id, data
44-
)
45-
out, _ = capsys.readouterr()
46-
assert "Data imported." in out
4739

4840
# delete dataset
4941
automl_natural_language_dataset.delete_dataset(
@@ -53,6 +45,28 @@ def test_dataset_create_import_delete(capsys):
5345
assert "Dataset deleted." in out
5446

5547

48+
def test_import_data(capsys):
49+
# As importing a dataset can take a long time and only four operations can
50+
# be run on a dataset at once. Try to import into a nonexistent dataset and
51+
# confirm that the dataset was not found, but other elements of the request
52+
# were valid.
53+
try:
54+
data = "gs://{}-lcm/happiness.csv".format(project_id)
55+
automl_natural_language_dataset.import_data(
56+
project_id, compute_region, "TEN0000000000000000000", data
57+
)
58+
out, _ = capsys.readouterr()
59+
assert (
60+
"Dataset doesn't exist or is inaccessible for use with AutoMl."
61+
in out
62+
)
63+
except Exception as e:
64+
assert (
65+
"Dataset doesn't exist or is inaccessible for use with AutoMl."
66+
in e.message
67+
)
68+
69+
5670
def test_dataset_list_get(capsys):
5771
# list datasets
5872
automl_natural_language_dataset.list_datasets(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.