Skip to content

Commit 0052451

Browse files
committed
Smaller patch for tests
1 parent 13b065f commit 0052451

3 files changed

Lines changed: 2 additions & 35 deletions

File tree

Lib/test/datetimetester.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7270,8 +7270,7 @@ def test_update_type_cache(self):
72707270
assert isinstance(_datetime.timezone.utc, _datetime.tzinfo)
72717271
del sys.modules['_datetime']
72727272
""")
7273-
res = script_helper.assert_python_ok('-c', script)
7274-
self.assertFalse(res.err)
7273+
script_helper.assert_python_ok('-c', script)
72757274

72767275
def test_module_free(self):
72777276
script = textwrap.dedent("""

Lib/test/test_embed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ def test_datetime_capi_at_shutdown(self):
461461
import sys
462462
import _testcapi
463463
_testcapi.test_datetime_capi() # PyDateTime_IMPORT only once
464-
timedelta = _testcapi.get_capi_types()['timedelta']
464+
timedelta = type(_testcapi.get_delta_fromdsu(False, 1, 0, 0))
465465
466466
def gen():
467467
try:

Modules/_testcapi/datetime.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -453,37 +453,6 @@ test_PyDateTime_DELTA_GET(PyObject *self, PyObject *obj)
453453
return Py_BuildValue("(iii)", days, seconds, microseconds);
454454
}
455455

456-
static PyObject *
457-
get_capi_types(PyObject *self, PyObject *args)
458-
{
459-
if (PyDateTimeAPI == NULL) {
460-
Py_RETURN_NONE;
461-
}
462-
PyObject *dict = PyDict_New();
463-
if (dict == NULL) {
464-
return NULL;
465-
}
466-
if (PyDict_SetItemString(dict, "date", (PyObject *)PyDateTimeAPI->DateType) < 0) {
467-
goto error;
468-
}
469-
if (PyDict_SetItemString(dict, "time", (PyObject *)PyDateTimeAPI->TimeType) < 0) {
470-
goto error;
471-
}
472-
if (PyDict_SetItemString(dict, "datetime", (PyObject *)PyDateTimeAPI->DateTimeType) < 0) {
473-
goto error;
474-
}
475-
if (PyDict_SetItemString(dict, "timedelta", (PyObject *)PyDateTimeAPI->DeltaType) < 0) {
476-
goto error;
477-
}
478-
if (PyDict_SetItemString(dict, "tzinfo", (PyObject *)PyDateTimeAPI->TZInfoType) < 0) {
479-
goto error;
480-
}
481-
return dict;
482-
error:
483-
Py_DECREF(dict);
484-
return NULL;
485-
}
486-
487456
static PyMethodDef test_methods[] = {
488457
{"PyDateTime_DATE_GET", test_PyDateTime_DATE_GET, METH_O},
489458
{"PyDateTime_DELTA_GET", test_PyDateTime_DELTA_GET, METH_O},
@@ -504,7 +473,6 @@ static PyMethodDef test_methods[] = {
504473
{"get_time_fromtimeandfold", get_time_fromtimeandfold, METH_VARARGS},
505474
{"get_timezone_utc_capi", get_timezone_utc_capi, METH_VARARGS},
506475
{"get_timezones_offset_zero", get_timezones_offset_zero, METH_NOARGS},
507-
{"get_capi_types", get_capi_types, METH_NOARGS},
508476
{"make_timezones_capi", make_timezones_capi, METH_NOARGS},
509477
{"test_datetime_capi", test_datetime_capi, METH_NOARGS},
510478
{NULL},

0 commit comments

Comments
 (0)