Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support RANGE in queries Part 1: JSON #1884

Merged
merged 6 commits into from
Apr 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
fix typo
  • Loading branch information
Linchin committed Apr 10, 2024
commit e9a17ceec86c238656a130f3412522ce147bb21d
24 changes: 12 additions & 12 deletions tests/unit/test__helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,27 +467,27 @@ def test_w_none_required(self):

def test_w_wrong_format(self):
range_field = _Field(
"NULLIBLE",
"NULLABLE",
field_type="RANGE",
range_element_type=_Field("NULLIBLE", element_type="DATE"),
range_element_type=_Field("NULLABLE", element_type="DATE"),
)
with self.assertRaises(ValueError):
self._call_fut("[2009-06-172019-06-17)", range_field)

def test_w_wrong_element_type(self):
range_field = _Field(
"NULLIBLE",
"NULLABLE",
field_type="RANGE",
range_element_type=_Field("NULLIBLE", element_type="TIME"),
range_element_type=_Field("NULLABLE", element_type="TIME"),
)
with self.assertRaises(ValueError):
self._call_fut("[15:31:38, 15:50:38)", range_field)

def test_w_unbounded_value(self):
range_field = _Field(
"NULLIBLE",
"NULLABLE",
field_type="RANGE",
range_element_type=_Field("NULLIBLE", element_type="DATE"),
range_element_type=_Field("NULLABLE", element_type="DATE"),
)
coerced = self._call_fut("[UNBOUNDED, 2019-06-17)", range_field)
self.assertEqual(
Expand All @@ -497,9 +497,9 @@ def test_w_unbounded_value(self):

def test_w_date_value(self):
range_field = _Field(
"NULLIBLE",
"NULLABLE",
field_type="RANGE",
range_element_type=_Field("NULLIBLE", element_type="DATE"),
range_element_type=_Field("NULLABLE", element_type="DATE"),
)
coerced = self._call_fut("[2009-06-17, 2019-06-17)", range_field)
self.assertEqual(
Expand All @@ -512,9 +512,9 @@ def test_w_date_value(self):

def test_w_datetime_value(self):
range_field = _Field(
"NULLIBLE",
"NULLABLE",
field_type="RANGE",
range_element_type=_Field("NULLIBLE", element_type="DATETIME"),
range_element_type=_Field("NULLABLE", element_type="DATETIME"),
)
coerced = self._call_fut(
"[2009-06-17T13:45:30, 2019-06-17T13:45:30)", range_field
Expand All @@ -531,9 +531,9 @@ def test_w_timestamp_value(self):
from google.cloud._helpers import _EPOCH

range_field = _Field(
"NULLIBLE",
"NULLABLE",
field_type="RANGE",
range_element_type=_Field("NULLIBLE", element_type="TIMESTAMP"),
range_element_type=_Field("NULLABLE", element_type="TIMESTAMP"),
)
coerced = self._call_fut("[1234567, 1234789)", range_field)
self.assertEqual(
Expand Down