Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
e990db84
Commit
e990db84
authored
May 16, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more test fixes
parent
2895952e
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
87 additions
and
83 deletions
+87
-83
tests/run/__getattribute__.pyx
tests/run/__getattribute__.pyx
+4
-4
tests/run/__getattribute_subclasses__.pyx
tests/run/__getattribute_subclasses__.pyx
+28
-29
tests/run/cstringmul.pyx
tests/run/cstringmul.pyx
+2
-3
tests/run/dict.pyx
tests/run/dict.pyx
+4
-5
tests/run/kwargproblems.pyx
tests/run/kwargproblems.pyx
+7
-2
tests/run/modbody.pyx
tests/run/modbody.pyx
+9
-6
tests/run/print.pyx
tests/run/print.pyx
+1
-2
tests/run/r_argdefault.pyx
tests/run/r_argdefault.pyx
+3
-3
tests/run/r_bishop3.pyx
tests/run/r_bishop3.pyx
+2
-2
tests/run/r_extcomplex2.pyx
tests/run/r_extcomplex2.pyx
+2
-2
tests/run/r_extstarargs.pyx
tests/run/r_extstarargs.pyx
+4
-4
tests/run/r_forloop.pyx
tests/run/r_forloop.pyx
+1
-1
tests/run/r_jiba1.pyx
tests/run/r_jiba1.pyx
+2
-2
tests/run/r_print.pyx
tests/run/r_print.pyx
+1
-1
tests/run/r_pyclass.pyx
tests/run/r_pyclass.pyx
+1
-1
tests/run/r_pyclassdefault.pyx
tests/run/r_pyclassdefault.pyx
+3
-3
tests/run/r_spamtype.pyx
tests/run/r_spamtype.pyx
+1
-1
tests/run/r_starargcall.pyx
tests/run/r_starargcall.pyx
+2
-2
tests/run/strfunction.pyx
tests/run/strfunction.pyx
+1
-1
tests/run/unicodeliterals.pyx
tests/run/unicodeliterals.pyx
+3
-3
tests/run/unicodeliteralsdefault.pyx
tests/run/unicodeliteralsdefault.pyx
+3
-3
tests/run/unicodeliteralslatin1.pyx
tests/run/unicodeliteralslatin1.pyx
+3
-3
No files found.
tests/run/__getattribute__.pyx
View file @
e990db84
...
...
@@ -29,7 +29,7 @@ __getattribute__ and __getattr__ special methods for a single class.
cdef
class
just_getattribute
:
def
__getattribute__
(
self
,
n
):
if
n
==
'bar'
:
if
n
==
u
'bar'
:
return
n
else
:
raise
AttributeError
...
...
@@ -39,7 +39,7 @@ cdef class just_getattr:
def
__init__
(
self
):
self
.
foo
=
10
def
__getattr__
(
self
,
n
):
if
n
==
'bar'
:
if
n
==
u
'bar'
:
return
n
else
:
raise
AttributeError
...
...
@@ -49,12 +49,12 @@ cdef class both:
def
__init__
(
self
):
self
.
foo
=
10
def
__getattribute__
(
self
,
n
):
if
n
==
'foo'
:
if
n
==
u
'foo'
:
return
self
.
foo
else
:
raise
AttributeError
def
__getattr__
(
self
,
n
):
if
n
==
'bar'
:
if
n
==
u
'bar'
:
return
n
else
:
raise
AttributeError
tests/run/__getattribute_subclasses__.pyx
View file @
e990db84
...
...
@@ -5,16 +5,16 @@ getattr does not override members.
>>> a = getattr_boring()
>>> a.boring_member
10
>>>
a.resolved_by
'getattr_boring'
>>>
print(a.resolved_by)
getattr_boring
getattribute does.
>>> a = getattribute_boring()
>>> a.boring_member
Traceback (most recent call last):
AttributeError
>>>
a.resolved_by
'getattribute_boring'
>>>
print(a.resolved_by)
getattribute_boring
Is inherited.
>>> a = boring_boring_getattribute()
...
...
@@ -24,8 +24,8 @@ Is inherited.
>>> a.boring_boring_getattribute_member
Traceback (most recent call last):
AttributeError
>>>
a.resolved_by
'_getattribute'
>>>
print(a.resolved_by)
_getattribute
__getattribute__ is always tried first, then __getattr__, regardless of where
in the inheritance hiarchy they came from.
...
...
@@ -33,8 +33,8 @@ in the inheritance hiarchy they came from.
>>> a.foo
Traceback (most recent call last):
AttributeError
>>>
a.resolved_by
'getattribute_boring_boring_getattr'
>>>
print(a.resolved_by)
getattribute_boring_boring_getattr
>>> a.getattribute_boring_boring_getattr
True
>>> a._getattr
...
...
@@ -44,8 +44,8 @@ in the inheritance hiarchy they came from.
>>> a.foo
Traceback (most recent call last):
AttributeError
>>>
a.resolved_by
'_getattribute'
>>>
print(a.resolved_by)
_getattribute
>>> a.getattr_boring_boring_getattribute
True
>>> a._getattribute
...
...
@@ -60,36 +60,36 @@ cdef class boring:
cdef
class
getattr_boring
(
boring
):
def
__getattr__
(
self
,
n
):
if
n
==
'resolved_by'
:
return
'getattr_boring'
elif
n
==
'getattr_boring'
:
if
n
==
u
'resolved_by'
:
return
u
'getattr_boring'
elif
n
==
u
'getattr_boring'
:
return
True
else
:
raise
AttributeError
cdef
class
getattribute_boring
(
boring
):
def
__getattribute__
(
self
,
n
):
if
n
==
'resolved_by'
:
return
'getattribute_boring'
elif
n
==
'getattribute_boring'
:
if
n
==
u
'resolved_by'
:
return
u
'getattribute_boring'
elif
n
==
u
'getattribute_boring'
:
return
True
else
:
raise
AttributeError
cdef
class
_getattr
:
def
__getattr__
(
self
,
n
):
if
n
==
'resolved_by'
:
return
'_getattr'
elif
n
==
'_getattr'
:
if
n
==
u
'resolved_by'
:
return
u
'_getattr'
elif
n
==
u
'_getattr'
:
return
True
else
:
raise
AttributeError
cdef
class
_getattribute
(
boring
):
def
__getattribute__
(
self
,
n
):
if
n
==
'resolved_by'
:
return
'_getattribute'
elif
n
==
'_getattribute'
:
if
n
==
u
'resolved_by'
:
return
u
'_getattribute'
elif
n
==
u
'_getattribute'
:
return
True
else
:
raise
AttributeError
...
...
@@ -108,19 +108,18 @@ cdef class boring_boring_getattr(boring_getattr):
cdef
class
getattribute_boring_boring_getattr
(
boring_boring_getattr
):
def
__getattribute__
(
self
,
n
):
if
n
==
'resolved_by'
:
return
'getattribute_boring_boring_getattr'
elif
n
==
'getattribute_boring_boring_getattr'
:
if
n
==
u
'resolved_by'
:
return
u
'getattribute_boring_boring_getattr'
elif
n
==
u
'getattribute_boring_boring_getattr'
:
return
True
else
:
raise
AttributeError
cdef
class
getattr_boring_boring_getattribute
(
boring_boring_getattribute
):
def
__getattr__
(
self
,
n
):
if
n
==
'resolved_by'
:
return
'getattr_boring_boring_getattribute'
elif
n
==
'getattr_boring_boring_getattribute'
:
if
n
==
u
'resolved_by'
:
return
u
'getattr_boring_boring_getattribute'
elif
n
==
u
'getattr_boring_boring_getattribute'
:
return
True
else
:
raise
AttributeError
tests/run/cstringmul.pyx
View file @
e990db84
...
...
@@ -5,6 +5,5 @@ __doc__ = u"""
tomatotomatotomatotomatotomatotomatotomato
"""
spam
=
"eggs"
*
4
grail
=
7
*
"tomato"
spam
=
u"eggs"
*
4
grail
=
7
*
u"tomato"
tests/run/dict.pyx
View file @
e990db84
...
...
@@ -11,9 +11,9 @@ __doc__ = u"""
>>> len(constant())
2
>>>
constant()['parrot']
'resting'
>>>
constant()['answer']
>>>
print(constant()['parrot'])
resting
>>>
print(constant()['answer'])
42
"""
...
...
@@ -34,6 +34,5 @@ def keyvalues2(key1, value1, key2, value2):
return
d
def
constant
():
d
=
{
"parrot"
:
"resting"
,
"answer"
:
42
}
d
=
{
u"parrot"
:
u"resting"
,
u
"answer"
:
42
}
return
d
tests/run/kwargproblems.pyx
View file @
e990db84
...
...
@@ -12,13 +12,18 @@ __doc__ = u"""
>>> d
{}
>>> d = {'arg' : 2}
>>> d = {'arg' : 2}
# this should be u'arg', but Py2 can't handle it...
>>> test(**d)
{'arg': 3}
>>> d
{'arg': 2}
"""
import
sys
def
test
(
**
kw
):
kw
[
'arg'
]
=
3
if
sys
.
version_info
[
0
]
>=
3
:
kw
[
u'arg'
]
=
3
else
:
kw
[
'arg'
]
=
3
return
kw
tests/run/modbody.pyx
View file @
e990db84
...
...
@@ -3,19 +3,22 @@ __doc__ = u"""
>>> g
42
>>> x
'spam'
u
'spam'
>>> y
'eggs'
u
'eggs'
>>> z
'spameggs'
u
'spameggs'
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u" u'"
,
u" '"
)
def
f
():
pass
g
=
42
x
=
"spam"
y
=
"eggs"
x
=
u
"spam"
y
=
u
"eggs"
if
g
:
z
=
x
+
y
tests/run/print.pyx
View file @
e990db84
...
...
@@ -11,5 +11,4 @@ def f(a, b):
print
a
print
a
,
b
print
a
,
b
,
print
42
,
"spam"
print
42
,
u"spam"
tests/run/r_argdefault.pyx
View file @
e990db84
...
...
@@ -9,9 +9,9 @@ __doc__ = u"""
def
swallow
(
name
=
None
,
airspeed
=
None
,
coconuts
=
None
):
if
name
is
not
None
:
print
"This swallow is called"
,
name
print
u
"This swallow is called"
,
name
if
airspeed
is
not
None
:
print
"This swallow is flying at"
,
airspeed
,
"furlongs per fortnight"
print
u"This swallow is flying at"
,
airspeed
,
u
"furlongs per fortnight"
if
coconuts
is
not
None
:
print
"This swallow is carrying"
,
coconuts
,
"coconuts"
print
u"This swallow is carrying"
,
coconuts
,
u
"coconuts"
tests/run/r_bishop3.pyx
View file @
e990db84
...
...
@@ -18,10 +18,10 @@ cdef class Foo:
cdef
class
Fee
(
Foo
):
def
bof
(
self
):
print
'Fee bof'
,
self
.
val
print
u
'Fee bof'
,
self
.
val
cdef
class
Faa
(
Fee
):
def
bof
(
self
):
print
'Foo bof'
,
self
.
val
print
u
'Foo bof'
,
self
.
val
tests/run/r_extcomplex2.pyx
View file @
e990db84
...
...
@@ -17,8 +17,8 @@ cdef extern from "complexobject.h":
cdef
Py_complex
cval
def
spam
(
complex
c
):
print
"Real:"
,
c
.
cval
.
real
print
"Imag:"
,
c
.
cval
.
imag
print
u
"Real:"
,
c
.
cval
.
real
print
u
"Imag:"
,
c
.
cval
.
imag
def
eggs
():
return
complex
(
17
,
42
)
tests/run/r_extstarargs.pyx
View file @
e990db84
...
...
@@ -33,7 +33,7 @@ __doc__ = u"""
cdef
class
Swallow
:
def
__init__
(
self
,
name
,
airspeed
,
*
args
,
**
kwds
):
print
"Name:"
,
name
print
"Airspeed:"
,
airspeed
print
"Extra args:"
,
args
print
"Extra keywords:"
,
kwds
print
u
"Name:"
,
name
print
u
"Airspeed:"
,
airspeed
print
u
"Extra args:"
,
args
print
u
"Extra keywords:"
,
kwds
tests/run/r_forloop.pyx
View file @
e990db84
...
...
@@ -9,5 +9,5 @@ __doc__ = u"""
def
go
():
for
i
in
range
(
5
):
print
"Spam!"
print
u
"Spam!"
tests/run/r_jiba1.pyx
View file @
e990db84
...
...
@@ -8,7 +8,7 @@ __doc__ = u"""
cdef
class
Parrot
:
cdef
void
describe
(
self
):
print
"This parrot is resting."
print
u
"This parrot is resting."
def
describe_python
(
self
):
self
.
describe
()
...
...
@@ -16,7 +16,7 @@ cdef class Parrot:
cdef
class
Norwegian
(
Parrot
):
cdef
void
describe
(
self
):
print
"Lovely plumage!"
print
u
"Lovely plumage!"
def
test
():
cdef
Parrot
p1
,
p2
...
...
tests/run/r_print.pyx
View file @
e990db84
...
...
@@ -4,5 +4,5 @@ __doc__ = u"""
"""
def
frighten
():
print
"NOBODY"
,
"expects"
,
"the Spanish Inquisition!"
print
u"NOBODY"
,
u"expects"
,
u
"the Spanish Inquisition!"
tests/run/r_pyclass.pyx
View file @
e990db84
...
...
@@ -9,7 +9,7 @@ class Spam:
self
.
weight
=
w
def
serve
(
self
):
print
self
.
weight
,
"tons of spam!"
print
self
.
weight
,
u
"tons of spam!"
def
order
():
s
=
Spam
(
42
)
...
...
tests/run/r_pyclassdefault.pyx
View file @
e990db84
...
...
@@ -12,8 +12,8 @@ class CoconutCarrier:
def
swallow
(
self
,
name
=
None
,
airspeed
=
None
,
coconuts
=
None
):
if
name
is
not
None
:
print
"This swallow is called"
,
name
print
u
"This swallow is called"
,
name
if
airspeed
is
not
None
:
print
"This swallow is flying at"
,
airspeed
,
"furlongs per fortnight"
print
u
"This swallow is flying at"
,
airspeed
,
"furlongs per fortnight"
if
coconuts
is
not
None
:
print
"This swallow is carrying"
,
coconuts
,
"coconuts"
print
u
"This swallow is carrying"
,
coconuts
,
"coconuts"
tests/run/r_spamtype.pyx
View file @
e990db84
...
...
@@ -17,7 +17,7 @@ cdef class Spam:
self
.
tons
=
17
def
__dealloc__
(
self
):
print
self
.
tons
,
"tons of spam is history."
print
self
.
tons
,
u
"tons of spam is history."
def
get_tons
(
self
):
return
self
.
tons
...
...
tests/run/r_starargcall.pyx
View file @
e990db84
...
...
@@ -5,9 +5,9 @@ __doc__ = u"""
"""
def
spam
(
a
,
b
,
c
):
print
"Args:"
,
a
,
b
,
c
print
u
"Args:"
,
a
,
b
,
c
def
eggs
():
spam
(
*
(
1
,
2
,
3
))
spam
(
*
[
"buckle"
,
"my"
,
"shoe"
])
spam
(
*
[
u"buckle"
,
u"my"
,
u
"shoe"
])
tests/run/strfunction.pyx
View file @
e990db84
...
...
@@ -18,7 +18,7 @@ __doc__ = u"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
encoding
=
{
'encoding'
:
'ASCII'
}
encoding
=
{
u'encoding'
:
u
'ASCII'
}
else
:
encoding
=
{}
__doc__
=
__doc__
.
replace
(
u" b'"
,
u" '"
)
...
...
tests/run/unicodeliterals.pyx
View file @
e990db84
...
...
@@ -19,7 +19,7 @@ __doc__ = r"""
u'S\xf8k ik\xfc\xd6\xe4abc'
>>> null
u'\x00'
"""
.
decode
(
"ASCII"
)
+
"""
"""
.
decode
(
u
"ASCII"
)
+
"""
>>> len(sa)
3
>>> len(ua)
...
...
@@ -38,7 +38,7 @@ __doc__ = r"""
12
>>> len(null)
1
"""
.
decode
(
"ASCII"
)
+
u"""
"""
.
decode
(
u
"ASCII"
)
+
u"""
>>> sa == 'abc'
True
>>> ua == u'abc'
...
...
@@ -76,5 +76,5 @@ d = u'üÖä'
e
=
u'
\
x03
\
x67
\
xf8
\
uf8d2
Søk ik'
f
=
u'
\
xf8
'
add
=
u'Søk ik'
+
u'üÖä'
+
'abc'
add
=
u'Søk ik'
+
u'üÖä'
+
u
'abc'
null
=
u'
\
x00
'
tests/run/unicodeliteralsdefault.pyx
View file @
e990db84
...
...
@@ -25,7 +25,7 @@ __doc__ = r"""
u'S\xf8k ik\xfc\xd6\xe4abc'
>>> null
u'\x00'
"""
.
decode
(
"ASCII"
)
+
"""
"""
.
decode
(
u
"ASCII"
)
+
"""
>>> len(sa)
3
>>> len(ua)
...
...
@@ -44,7 +44,7 @@ __doc__ = r"""
12
>>> len(null)
1
"""
.
decode
(
"ASCII"
)
+
u"""
"""
.
decode
(
u
"ASCII"
)
+
u"""
>>> sa == 'abc'
True
>>> ua == u'abc'
...
...
@@ -82,5 +82,5 @@ d = u'üÖä'
e
=
u'
\
x03
\
x67
\
xf8
\
uf8d2
Søk ik'
f
=
u'
\
xf8
'
add
=
u'Søk ik'
+
u'üÖä'
+
'abc'
add
=
u'Søk ik'
+
u'üÖä'
+
u
'abc'
null
=
u'
\
x00
'
tests/run/unicodeliteralslatin1.pyx
View file @
e990db84
...
...
@@ -19,7 +19,7 @@ __doc__ = r"""
u'S\xf8k ik\xfc\xd6\xe4abc'
>>> null
u'\x00'
"""
.
decode
(
"ASCII"
)
+
"""
"""
.
decode
(
u
"ASCII"
)
+
"""
>>> len(sa)
3
>>> len(ua)
...
...
@@ -38,7 +38,7 @@ __doc__ = r"""
12
>>> len(null)
1
"""
.
decode
(
"ASCII"
)
+
u"""
"""
.
decode
(
u
"ASCII"
)
+
u"""
>>> sa == 'abc'
True
>>> ua == u'abc'
...
...
@@ -76,5 +76,5 @@ d = u'
e
=
u'
\
x03
\
x67
\
xf8
\
uf8d2
Sk ik'
f
=
u'
\
xf8
'
add
=
u'Sk ik'
+
u''
+
'abc'
add
=
u'Sk ik'
+
u''
+
u
'abc'
null
=
u'
\
x00
'
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