Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ea3f305a
Commit
ea3f305a
authored
Oct 02, 2010
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Oops, revert unwanted _testcapi changes of r85174
parent
749261e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
Lib/test/test_unicode.py
Lib/test/test_unicode.py
+11
-11
Modules/_testcapimodule.c
Modules/_testcapimodule.c
+4
-4
No files found.
Lib/test/test_unicode.py
View file @
ea3f305a
...
...
@@ -1396,26 +1396,26 @@ class UnicodeTest(string_tests.CommonTest,
# Test PyUnicode_AsWideChar()
def
test_aswidechar
(
self
):
from
_testcapi
import
unicode
_aswidechar
from
_testcapi
import
test
_aswidechar
from
ctypes
import
c_wchar
,
sizeof
wchar
,
size
=
unicode
_aswidechar
(
'abcdef'
,
2
)
wchar
,
size
=
test
_aswidechar
(
'abcdef'
,
2
)
self
.
assertEquals
(
size
,
2
)
self
.
assertEquals
(
wchar
,
'ab'
)
wchar
,
size
=
unicode
_aswidechar
(
'abc'
,
3
)
wchar
,
size
=
test
_aswidechar
(
'abc'
,
3
)
self
.
assertEquals
(
size
,
3
)
self
.
assertEquals
(
wchar
,
'abc'
)
wchar
,
size
=
unicode
_aswidechar
(
'abc'
,
4
)
wchar
,
size
=
test
_aswidechar
(
'abc'
,
4
)
self
.
assertEquals
(
size
,
3
)
self
.
assertEquals
(
wchar
,
'abc
\
0
'
)
wchar
,
size
=
unicode
_aswidechar
(
'abc'
,
10
)
wchar
,
size
=
test
_aswidechar
(
'abc'
,
10
)
self
.
assertEquals
(
size
,
3
)
self
.
assertEquals
(
wchar
,
'abc
\
0
'
)
wchar
,
size
=
unicode
_aswidechar
(
'abc
\
0
def'
,
20
)
wchar
,
size
=
test
_aswidechar
(
'abc
\
0
def'
,
20
)
self
.
assertEquals
(
size
,
7
)
self
.
assertEquals
(
wchar
,
'abc
\
0
def
\
0
'
)
...
...
@@ -1426,20 +1426,20 @@ class UnicodeTest(string_tests.CommonTest,
else
:
# sizeof(c_wchar) == 4
buflen
=
2
nchar
=
1
wchar
,
size
=
unicode
_aswidechar
(
nonbmp
,
buflen
)
wchar
,
size
=
test
_aswidechar
(
nonbmp
,
buflen
)
self
.
assertEquals
(
size
,
nchar
)
self
.
assertEquals
(
wchar
,
nonbmp
+
'
\
0
'
)
# Test PyUnicode_AsWideCharString()
def
test_aswidecharstring
(
self
):
from
_testcapi
import
unicode
_aswidecharstring
from
_testcapi
import
test
_aswidecharstring
from
ctypes
import
c_wchar
,
sizeof
wchar
,
size
=
unicode
_aswidecharstring
(
'abc'
)
wchar
,
size
=
test
_aswidecharstring
(
'abc'
)
self
.
assertEquals
(
size
,
3
)
self
.
assertEquals
(
wchar
,
'abc
\
0
'
)
wchar
,
size
=
unicode
_aswidecharstring
(
'abc
\
0
def'
)
wchar
,
size
=
test
_aswidecharstring
(
'abc
\
0
def'
)
self
.
assertEquals
(
size
,
7
)
self
.
assertEquals
(
wchar
,
'abc
\
0
def
\
0
'
)
...
...
@@ -1448,7 +1448,7 @@ class UnicodeTest(string_tests.CommonTest,
nchar
=
2
else
:
# sizeof(c_wchar) == 4
nchar
=
1
wchar
,
size
=
unicode
_aswidecharstring
(
nonbmp
)
wchar
,
size
=
test
_aswidecharstring
(
nonbmp
)
self
.
assertEquals
(
size
,
nchar
)
self
.
assertEquals
(
wchar
,
nonbmp
+
'
\
0
'
)
...
...
Modules/_testcapimodule.c
View file @
ea3f305a
...
...
@@ -1386,7 +1386,7 @@ test_widechar(PyObject *self)
}
static
PyObject
*
unicode
_aswidechar
(
PyObject
*
self
,
PyObject
*
args
)
test
_aswidechar
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
unicode
,
*
result
;
Py_ssize_t
buflen
,
size
;
...
...
@@ -1417,7 +1417,7 @@ unicode_aswidechar(PyObject *self, PyObject *args)
}
static
PyObject
*
unicode
_aswidecharstring
(
PyObject
*
self
,
PyObject
*
args
)
test
_aswidecharstring
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
unicode
,
*
result
;
Py_ssize_t
size
;
...
...
@@ -2321,8 +2321,8 @@ static PyMethodDef TestMethods[] = {
{
"test_u_code"
,
(
PyCFunction
)
test_u_code
,
METH_NOARGS
},
{
"test_Z_code"
,
(
PyCFunction
)
test_Z_code
,
METH_NOARGS
},
{
"test_widechar"
,
(
PyCFunction
)
test_widechar
,
METH_NOARGS
},
{
"
unicode_aswidechar"
,
unicode
_aswidechar
,
METH_VARARGS
},
{
"
unicode_aswidecharstring"
,
unicode
_aswidecharstring
,
METH_VARARGS
},
{
"
test_aswidechar"
,
test
_aswidechar
,
METH_VARARGS
},
{
"
test_aswidecharstring"
,
test
_aswidecharstring
,
METH_VARARGS
},
#ifdef WITH_THREAD
{
"_test_thread_state"
,
test_thread_state
,
METH_VARARGS
},
{
"_pending_threadfunc"
,
pending_threadfunc
,
METH_VARARGS
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment