summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-02-20 14:53:40 (GMT)
committerGitHub <noreply@github.com>2024-02-20 14:53:40 (GMT)
commite00960a74d66f95b7803f8e5546267a078fd065c (patch)
tree1d9c571af6a883ea6136ece250e4d2568cf55ace
parent1ff6c1416b0bb422f4847cd84fcb33662a2497ef (diff)
downloadcpython-e00960a74d66f95b7803f8e5546267a078fd065c.zip
cpython-e00960a74d66f95b7803f8e5546267a078fd065c.tar.gz
cpython-e00960a74d66f95b7803f8e5546267a078fd065c.tar.bz2
gh-110850: Enhance PyTime C API tests (#115715)
-rw-r--r--Modules/_testcapi/time.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Modules/_testcapi/time.c b/Modules/_testcapi/time.c
index 57eb913..68f082b 100644
--- a/Modules/_testcapi/time.c
+++ b/Modules/_testcapi/time.c
@@ -49,9 +49,11 @@ static PyObject*
test_pytime_monotonic(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args))
{
PyTime_t t;
- if (PyTime_Monotonic(&t) < 0) {
+ int res = PyTime_Monotonic(&t);
+ if (res < 0) {
return NULL;
}
+ assert(res == 0);
return pytime_as_float(t);
}
@@ -60,9 +62,11 @@ static PyObject*
test_pytime_perf_counter(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args))
{
PyTime_t t;
- if (PyTime_PerfCounter(&t) < 0) {
+ int res = PyTime_PerfCounter(&t);
+ if (res < 0) {
return NULL;
}
+ assert(res == 0);
return pytime_as_float(t);
}
@@ -71,10 +75,11 @@ static PyObject*
test_pytime_time(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args))
{
PyTime_t t;
- if (PyTime_Time(&t) < 0) {
- printf("ERR! %d\n", (int)t);
+ int res = PyTime_Time(&t);
+ if (res < 0) {
return NULL;
}
+ assert(res == 0);
return pytime_as_float(t);
}