diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-08-23 12:30:21 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-23 12:30:21 -0700 |
| commit | 6ff7fefc914541ec5afdd3c8193da80818cb0817 (patch) | |
| tree | 10ab36305dc28ed2e2035ef2c924af6f6705de01 /Lib/test | |
| parent | c6c120ddfa2eaa55db4fc1311b5107f6a7c99d88 (diff) | |
| download | cpython-git-6ff7fefc914541ec5afdd3c8193da80818cb0817.tar.gz | |
bpo-44984: Rewrite test_null_strings in _testcapi (GH-27904)
Test also PyObject_Repr(NULL) and PyObject_Bytes(NULL).
(cherry picked from commit 4d689173861257c69adc6dc1dca4171946ddb57f)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_capi.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index f9c5aca728..5f78c33702 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -619,6 +619,18 @@ class CAPITest(unittest.TestCase): ''') self.check_fatal_error(code, expected) + def test_pyobject_repr_from_null(self): + s = _testcapi.pyobject_repr_from_null() + self.assertEqual(s, '<NULL>') + + def test_pyobject_str_from_null(self): + s = _testcapi.pyobject_str_from_null() + self.assertEqual(s, '<NULL>') + + def test_pyobject_bytes_from_null(self): + s = _testcapi.pyobject_bytes_from_null() + self.assertEqual(s, b'<NULL>') + class TestPendingCalls(unittest.TestCase): |
