Skip to content

Commit

Permalink
Final review pass.
Browse files Browse the repository at this point in the history
Using `assertRaises` instead of a `self.fail()` branch that
will never get triggered.

Also moving around imports in `google.cloud.spanner_v1.database`
to be alphabetical / separated by 1st-party and 3rd-party.
  • Loading branch information
dhermes committed Dec 20, 2017
1 parent 7c9b048 commit 9c62777
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 4 additions & 4 deletions spanner/google/cloud/spanner_v1/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
import re
import threading

import google.auth.credentials
from google.api_core import exceptions
import google.auth.credentials
from google.cloud.exceptions import Conflict
from google.cloud.exceptions import NotFound
from google.gax.errors import GaxError
from google.gax.grpc import exc_to_code
from google.cloud.spanner_v1.gapic.spanner_client import SpannerClient
from grpc import StatusCode
import six

# pylint: disable=ungrouped-imports
from google.cloud.exceptions import Conflict
from google.cloud.exceptions import NotFound
from google.cloud.spanner_v1 import __version__
from google.cloud.spanner_v1._helpers import _options_with_prefix
from google.cloud.spanner_v1.batch import Batch
from google.cloud.spanner_v1.gapic.spanner_client import SpannerClient
from google.cloud.spanner_v1.pool import BurstyPool
from google.cloud.spanner_v1.pool import SessionCheckout
from google.cloud.spanner_v1.session import Session
Expand Down
10 changes: 4 additions & 6 deletions spanner/tests/system/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,11 @@ def test_table_not_found(self):
index,
],
)
try:
with self.assertRaises(NotFound) as exc_info:
temp_db.create()
except NotFound as exc:
self.assertEqual(exc.args[0],
'Table not found: {0}'.format(incorrect_table))
except:
self.fail()

expected = 'Table not found: {0}'.format(incorrect_table)
self.assertEqual(exc_info.exception.args, (expected,))

def test_update_database_ddl(self):
pool = BurstyPool()
Expand Down

0 comments on commit 9c62777

Please sign in to comment.