From 9def432e1fd066ea91adfed8d9f0acdf0774f374 Mon Sep 17 00:00:00 2001 From: test-codeop <78349281+test-codeop@users.noreply.github.com> Date: Wed, 21 Oct 2026 19:56:13 +0100 Subject: [PATCH 1/2] Replay added lines from example PR --- .uncover-agent/added.py | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .uncover-agent/added.py diff --git a/.uncover-agent/added.py b/.uncover-agent/added.py new file mode 100644 index 000000000..66bd05a15 --- /dev/null +++ b/.uncover-agent/added.py @@ -0,0 +1,43 @@ + elif _is_numpy_scalar(obj, 'integer'): + elif _is_numpy_scalar(obj, 'floating'): + elif _is_numpy_scalar(obj, 'bool', 'bool_'): + return bool(obj) +def _is_numpy_scalar(obj: Any, *type_names: str) -> bool: + """ + helper function to check whether an object is a NumPy scalar of + a given abstract type (e.g. `integer` covers `int8` to `uint64`), + without requiring NumPy to be installed + + :param obj: `object` to be evaluated + :param type_names: NumPy type names to match + + :returns: `bool` of whether the object is a matching NumPy scalar + """ + + return any(cls.__module__ == 'numpy' and cls.__name__ in type_names + for cls in type(obj).__mro__) + + +import json +import numpy as np + + +@pytest.mark.parametrize('value,expected', [ + (np.int8(-3), -3), + (np.int16(7), 7), + (np.int32(7), 7), + (np.int64(7), 7), + (np.uint8(255), 255), + (np.uint64(2**64 - 1), 2**64 - 1), + (np.float16(0.5), 0.5), + (np.float32(0.5), 0.5), + (np.float64(0.5), 0.5), + (np.bool_(True), True), +]) +def test_json_serial_numpy_scalars(value, expected): + result = util.json_serial(value) + assert result == expected + assert type(result) is type(expected) + assert json.loads(json.dumps({'value': value}, + default=util.json_serial)) == { + 'value': expected} \ No newline at end of file From f783b3a38961c467c0f8a7beaeca553cc364376d Mon Sep 17 00:00:00 2001 From: test-codeop <78349281+test-codeop@users.noreply.github.com> Date: Wed, 21 Oct 2026 19:56:14 +0100 Subject: [PATCH 2/2] uncover-agent: test diff marker --- .uncover-agent/NOTE.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .uncover-agent/NOTE.txt diff --git a/.uncover-agent/NOTE.txt b/.uncover-agent/NOTE.txt new file mode 100644 index 000000000..d792a52aa --- /dev/null +++ b/.uncover-agent/NOTE.txt @@ -0,0 +1,3 @@ +# uncover-agent test diff +# original: https://github.com/geopython/pygeoapi/pull/2418 +# generated 2026-10-21 18:56:14 UTC