Skip to content

Commit

Permalink
pythongh-110850: Enhance PyTime C API tests (python#115715)
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner authored and diegorusso committed Apr 17, 2024
1 parent 7df0390 commit 2d2ec89
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Modules/_testcapi/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down

0 comments on commit 2d2ec89

Please sign in to comment.