Skip to content

Commit

Permalink
Merge pull request #1626 from tseaver/drop-protobuf-internal-typechecker
Browse files Browse the repository at this point in the history
Drop look-before-leap use of protobuf-internal type checker.
  • Loading branch information
tseaver committed Mar 18, 2016
2 parents e433c37 + 0a4e531 commit 97f2e23
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
6 changes: 1 addition & 5 deletions gcloud/datastore/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import datetime

from google.protobuf.internal.type_checkers import Int64ValueChecker
import six

from gcloud._helpers import _datetime_from_microseconds
Expand All @@ -30,8 +29,6 @@

__all__ = ('entity_from_protobuf', 'key_from_protobuf')

INT_VALUE_CHECKER = Int64ValueChecker()


def find_true_project(project, connection):
"""Find the true (unaliased) project.
Expand Down Expand Up @@ -318,8 +315,7 @@ def _pb_attr_value(val):
elif isinstance(val, float):
name, value = 'double', val
elif isinstance(val, six.integer_types):
INT_VALUE_CHECKER.CheckValue(val) # Raise an exception if invalid.
name, value = 'integer', int(val) # Always cast to an integer.
name, value = 'integer', val
elif isinstance(val, six.text_type):
name, value = 'string', val
elif isinstance(val, (bytes, str)):
Expand Down
8 changes: 0 additions & 8 deletions gcloud/datastore/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,6 @@ def test_long(self):
self.assertEqual(name, 'integer_value')
self.assertEqual(value, must_be_long)

def test_long_too_small(self):
too_small = -(1 << 63) - 1
self.assertRaises(ValueError, self._callFUT, too_small)

def test_long_too_large(self):
too_large = 1 << 63
self.assertRaises(ValueError, self._callFUT, too_large)

def test_native_str(self):
import six
name, value = self._callFUT('str')
Expand Down

0 comments on commit 97f2e23

Please sign in to comment.