.. note::
@@ -227,6 +227,7 @@ We support:
- `Python 3.10`_
- `Python 3.11`_
- `Python 3.12`_
+- `Python 3.13`_
.. _Python 3.7: https://docs.python.org/3.7/
.. _Python 3.8: https://docs.python.org/3.8/
@@ -234,6 +235,7 @@ We support:
.. _Python 3.10: https://docs.python.org/3.10/
.. _Python 3.11: https://docs.python.org/3.11/
.. _Python 3.12: https://docs.python.org/3.12/
+.. _Python 3.13: https://docs.python.org/3.13/
Supported versions can be found in our ``noxfile.py`` `config`_.
diff --git a/google/cloud/spanner_admin_database_v1/gapic_version.py b/google/cloud/spanner_admin_database_v1/gapic_version.py
index 789bd07c63..873057e050 100644
--- a/google/cloud/spanner_admin_database_v1/gapic_version.py
+++ b/google/cloud/spanner_admin_database_v1/gapic_version.py
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-__version__ = "3.50.0" # {x-release-please-version}
+__version__ = "3.50.1" # {x-release-please-version}
diff --git a/google/cloud/spanner_admin_instance_v1/gapic_version.py b/google/cloud/spanner_admin_instance_v1/gapic_version.py
index 789bd07c63..873057e050 100644
--- a/google/cloud/spanner_admin_instance_v1/gapic_version.py
+++ b/google/cloud/spanner_admin_instance_v1/gapic_version.py
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-__version__ = "3.50.0" # {x-release-please-version}
+__version__ = "3.50.1" # {x-release-please-version}
diff --git a/google/cloud/spanner_v1/data_types.py b/google/cloud/spanner_v1/data_types.py
index 63897b293c..6b1ba5df49 100644
--- a/google/cloud/spanner_v1/data_types.py
+++ b/google/cloud/spanner_v1/data_types.py
@@ -31,6 +31,7 @@ class JsonObject(dict):
def __init__(self, *args, **kwargs):
self._is_null = (args, kwargs) == ((), {}) or args == (None,)
self._is_array = len(args) and isinstance(args[0], (list, tuple))
+ self._is_scalar_value = len(args) == 1 and not isinstance(args[0], (list, dict))
# if the JSON object is represented with an array,
# the value is contained separately
@@ -38,10 +39,18 @@ def __init__(self, *args, **kwargs):
self._array_value = args[0]
return
+ # If it's a scalar value, set _simple_value and return early
+ if self._is_scalar_value:
+ self._simple_value = args[0]
+ return
+
if len(args) and isinstance(args[0], JsonObject):
self._is_array = args[0]._is_array
+ self._is_scalar_value = args[0]._is_scalar_value
if self._is_array:
self._array_value = args[0]._array_value
+ elif self._is_scalar_value:
+ self._simple_value = args[0]._simple_value
if not self._is_null:
super(JsonObject, self).__init__(*args, **kwargs)
@@ -50,6 +59,9 @@ def __repr__(self):
if self._is_array:
return str(self._array_value)
+ if self._is_scalar_value:
+ return str(self._simple_value)
+
return super(JsonObject, self).__repr__()
@classmethod
@@ -76,6 +88,9 @@ def serialize(self):
if self._is_null:
return None
+ if self._is_scalar_value:
+ return json.dumps(self._simple_value)
+
if self._is_array:
return json.dumps(self._array_value, sort_keys=True, separators=(",", ":"))
diff --git a/google/cloud/spanner_v1/gapic_version.py b/google/cloud/spanner_v1/gapic_version.py
index 789bd07c63..873057e050 100644
--- a/google/cloud/spanner_v1/gapic_version.py
+++ b/google/cloud/spanner_v1/gapic_version.py
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-__version__ = "3.50.0" # {x-release-please-version}
+__version__ = "3.50.1" # {x-release-please-version}
diff --git a/noxfile.py b/noxfile.py
index 3b656a758c..f5a2761d73 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -34,7 +34,15 @@
DEFAULT_PYTHON_VERSION = "3.8"
-UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
+UNIT_TEST_PYTHON_VERSIONS: List[str] = [
+ "3.7",
+ "3.8",
+ "3.9",
+ "3.10",
+ "3.11",
+ "3.12",
+ "3.13",
+]
UNIT_TEST_STANDARD_DEPENDENCIES = [
"mock",
"asyncmock",
@@ -64,7 +72,6 @@
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
-# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
nox.options.sessions = [
"unit",
"system",
@@ -73,6 +80,7 @@
"lint_setup_py",
"blacken",
"docs",
+ "docfx",
"format",
]
@@ -193,7 +201,7 @@ def install_unittest_dependencies(session, *constraints):
def unit(session, protobuf_implementation):
# Install all test dependencies, then install this package in-place.
- if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
+ if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
session.skip("cpp implementation is not supported in python 3.11+")
constraints_path = str(
@@ -413,7 +421,7 @@ def docfx(session):
)
-@nox.session(python="3.12")
+@nox.session(python="3.13")
@nox.parametrize(
"protobuf_implementation,database_dialect",
[
@@ -428,7 +436,7 @@ def docfx(session):
def prerelease_deps(session, protobuf_implementation, database_dialect):
"""Run all tests with prerelease versions of dependencies installed."""
- if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
+ if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
session.skip("cpp implementation is not supported in python 3.11+")
# Install all dependencies
diff --git a/owlbot.py b/owlbot.py
index e9c12e593c..c215f26946 100644
--- a/owlbot.py
+++ b/owlbot.py
@@ -286,13 +286,13 @@ def system(session, database_dialect):""",
s.replace(
"noxfile.py",
- """\@nox.session\(python="3.12"\)
+ """\@nox.session\(python="3.13"\)
\@nox.parametrize\(
"protobuf_implementation",
\[ "python", "upb", "cpp" \],
\)
def prerelease_deps\(session, protobuf_implementation\):""",
- """@nox.session(python="3.12")
+ """@nox.session(python="3.13")
@nox.parametrize(
"protobuf_implementation,database_dialect",
[
diff --git a/samples/generated_samples/snippet_metadata_google.spanner.admin.database.v1.json b/samples/generated_samples/snippet_metadata_google.spanner.admin.database.v1.json
index 41b6a01194..9324f2056b 100644
--- a/samples/generated_samples/snippet_metadata_google.spanner.admin.database.v1.json
+++ b/samples/generated_samples/snippet_metadata_google.spanner.admin.database.v1.json
@@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-spanner-admin-database",
- "version": "3.50.0"
+ "version": "3.50.1"
},
"snippets": [
{
diff --git a/samples/generated_samples/snippet_metadata_google.spanner.admin.instance.v1.json b/samples/generated_samples/snippet_metadata_google.spanner.admin.instance.v1.json
index 4a263d05d6..7f64769236 100644
--- a/samples/generated_samples/snippet_metadata_google.spanner.admin.instance.v1.json
+++ b/samples/generated_samples/snippet_metadata_google.spanner.admin.instance.v1.json
@@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-spanner-admin-instance",
- "version": "3.50.0"
+ "version": "3.50.1"
},
"snippets": [
{
diff --git a/samples/generated_samples/snippet_metadata_google.spanner.v1.json b/samples/generated_samples/snippet_metadata_google.spanner.v1.json
index 8d75a90ecc..431109d19e 100644
--- a/samples/generated_samples/snippet_metadata_google.spanner.v1.json
+++ b/samples/generated_samples/snippet_metadata_google.spanner.v1.json
@@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-spanner",
- "version": "3.50.0"
+ "version": "3.50.1"
},
"snippets": [
{
diff --git a/samples/samples/noxfile.py b/samples/samples/noxfile.py
index 483b559017..a169b5b5b4 100644
--- a/samples/samples/noxfile.py
+++ b/samples/samples/noxfile.py
@@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
# DO NOT EDIT - automatically generated.
# All versions used to test samples.
-ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
+ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
# Any default versions that should be ignored.
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
diff --git a/tests/unit/test_datatypes.py b/tests/unit/test_datatypes.py
index 60630f73d3..65ccacb4ff 100644
--- a/tests/unit/test_datatypes.py
+++ b/tests/unit/test_datatypes.py
@@ -43,3 +43,56 @@ def test_w_JsonObject_of_list_of_dict(self):
expected = json.dumps(data, sort_keys=True, separators=(",", ":"))
data_jsonobject = JsonObject(JsonObject(data))
self.assertEqual(data_jsonobject.serialize(), expected)
+
+ def test_w_simple_float_JsonData(self):
+ data = 1.1
+ expected = json.dumps(data)
+ data_jsonobject = JsonObject(data)
+ self.assertEqual(data_jsonobject.serialize(), expected)
+
+ def test_w_simple_str_JsonData(self):
+ data = "foo"
+ expected = json.dumps(data)
+ data_jsonobject = JsonObject(data)
+ self.assertEqual(data_jsonobject.serialize(), expected)
+
+ def test_w_empty_str_JsonData(self):
+ data = ""
+ expected = json.dumps(data)
+ data_jsonobject = JsonObject(data)
+ self.assertEqual(data_jsonobject.serialize(), expected)
+
+ def test_w_None_JsonData(self):
+ data = None
+ data_jsonobject = JsonObject(data)
+ self.assertEqual(data_jsonobject.serialize(), None)
+
+ def test_w_list_of_simple_JsonData(self):
+ data = [1.1, "foo"]
+ expected = json.dumps(data, sort_keys=True, separators=(",", ":"))
+ data_jsonobject = JsonObject(data)
+ self.assertEqual(data_jsonobject.serialize(), expected)
+
+ def test_w_empty_list(self):
+ data = []
+ expected = json.dumps(data)
+ data_jsonobject = JsonObject(data)
+ self.assertEqual(data_jsonobject.serialize(), expected)
+
+ def test_w_empty_dict(self):
+ data = [{}]
+ expected = json.dumps(data)
+ data_jsonobject = JsonObject(data)
+ self.assertEqual(data_jsonobject.serialize(), expected)
+
+ def test_w_JsonObject_of_simple_JsonData(self):
+ data = 1.1
+ expected = json.dumps(data)
+ data_jsonobject = JsonObject(JsonObject(data))
+ self.assertEqual(data_jsonobject.serialize(), expected)
+
+ def test_w_JsonObject_of_list_of_simple_JsonData(self):
+ data = [1.1, "foo"]
+ expected = json.dumps(data, sort_keys=True, separators=(",", ":"))
+ data_jsonobject = JsonObject(JsonObject(data))
+ self.assertEqual(data_jsonobject.serialize(), expected)
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy