mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-110850: Enhance PyTime C API tests (#115715)
This commit is contained in:
parent
1ff6c1416b
commit
e00960a74d
1 changed files with 9 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue