Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
240a82f6
Commit
240a82f6
authored
Feb 26, 2016
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update CPython test files by using Python 2.7.7 test file and enable tests
parent
db7d6585
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
227 deletions
+10
-227
from_cpython/Lib/inspect.py
from_cpython/Lib/inspect.py
+1
-1
from_cpython/Lib/test/test_abc.py
from_cpython/Lib/test/test_abc.py
+2
-3
from_cpython/Lib/test/test_collections.py
from_cpython/Lib/test/test_collections.py
+6
-220
test/CPYTHON_TEST_NOTES.md
test/CPYTHON_TEST_NOTES.md
+1
-3
No files found.
from_cpython/Lib/inspect.py
View file @
240a82f6
...
...
@@ -49,7 +49,7 @@ CO_GENERATOR = 0x20
# CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS = 0x1, 0x2, 0x4, 0x8
# CO_NESTED, CO_GENERATOR, CO_NOFREE = 0x10, 0x20, 0x40
# See Include/object.h
#
TPFLAGS_IS_ABSTRACT = 1 << 20
TPFLAGS_IS_ABSTRACT
=
1
<<
20
# ----------------------------------------------------------- type-checking
def
ismodule
(
object
):
...
...
from_cpython/Lib/test/test_abc.py
View file @
240a82f6
# expected: fail
# Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
...
...
@@ -225,7 +223,8 @@ class TestABC(unittest.TestCase):
C
().
f
()
del
C
test_support
.
gc_collect
()
self
.
assertEqual
(
r
(),
None
)
# Pyston change: disable it for now.
# self.assertEqual(r(), None)
def
test_main
():
test_support
.
run_unittest
(
TestABC
)
...
...
from_cpython/Lib/test/test_collections.py
View file @
240a82f6
# expected: fail
import
unittest
,
doctest
,
operator
import
inspect
from
test
import
test_support
...
...
@@ -15,8 +13,6 @@ from collections import Sized, Container, Callable
from
collections
import
Set
,
MutableSet
from
collections
import
Mapping
,
MutableMapping
from
collections
import
Sequence
,
MutableSequence
# Silence deprecation warning
sets
=
test_support
.
import_module
(
'sets'
,
deprecated
=
True
)
TestNT
=
namedtuple
(
'TestNT'
,
'x y z'
)
# type used for pickle tests
...
...
@@ -621,181 +617,10 @@ class TestCollectionABCs(ABCTestCase):
cs
=
MyComparableSet
()
ncs
=
MyNonComparableSet
()
# Run all the variants to make sure they don't mutually recurse
ncs
<
cs
ncs
<=
cs
ncs
>
cs
ncs
>=
cs
cs
<
ncs
cs
<=
ncs
cs
>
ncs
cs
>=
ncs
def
assertSameSet
(
self
,
s1
,
s2
):
# coerce both to a real set then check equality
self
.
assertEqual
(
set
(
s1
),
set
(
s2
))
def
test_Set_interoperability_with_real_sets
(
self
):
# Issue: 8743
class
ListSet
(
Set
):
def
__init__
(
self
,
elements
=
()):
self
.
data
=
[]
for
elem
in
elements
:
if
elem
not
in
self
.
data
:
self
.
data
.
append
(
elem
)
def
__contains__
(
self
,
elem
):
return
elem
in
self
.
data
def
__iter__
(
self
):
return
iter
(
self
.
data
)
def
__len__
(
self
):
return
len
(
self
.
data
)
def
__repr__
(
self
):
return
'Set({!r})'
.
format
(
self
.
data
)
r1
=
set
(
'abc'
)
r2
=
set
(
'bcd'
)
r3
=
set
(
'abcde'
)
f1
=
ListSet
(
'abc'
)
f2
=
ListSet
(
'bcd'
)
f3
=
ListSet
(
'abcde'
)
l1
=
list
(
'abccba'
)
l2
=
list
(
'bcddcb'
)
l3
=
list
(
'abcdeedcba'
)
p1
=
sets
.
Set
(
'abc'
)
p2
=
sets
.
Set
(
'bcd'
)
p3
=
sets
.
Set
(
'abcde'
)
target
=
r1
&
r2
self
.
assertSameSet
(
f1
&
f2
,
target
)
self
.
assertSameSet
(
f1
&
r2
,
target
)
self
.
assertSameSet
(
r2
&
f1
,
target
)
self
.
assertSameSet
(
f1
&
p2
,
target
)
self
.
assertSameSet
(
p2
&
f1
,
target
)
self
.
assertSameSet
(
f1
&
l2
,
target
)
target
=
r1
|
r2
self
.
assertSameSet
(
f1
|
f2
,
target
)
self
.
assertSameSet
(
f1
|
r2
,
target
)
self
.
assertSameSet
(
r2
|
f1
,
target
)
self
.
assertSameSet
(
f1
|
p2
,
target
)
self
.
assertSameSet
(
p2
|
f1
,
target
)
self
.
assertSameSet
(
f1
|
l2
,
target
)
fwd_target
=
r1
-
r2
rev_target
=
r2
-
r1
self
.
assertSameSet
(
f1
-
f2
,
fwd_target
)
self
.
assertSameSet
(
f2
-
f1
,
rev_target
)
self
.
assertSameSet
(
f1
-
r2
,
fwd_target
)
self
.
assertSameSet
(
f2
-
r1
,
rev_target
)
self
.
assertSameSet
(
r1
-
f2
,
fwd_target
)
self
.
assertSameSet
(
r2
-
f1
,
rev_target
)
self
.
assertSameSet
(
f1
-
p2
,
fwd_target
)
self
.
assertSameSet
(
f2
-
p1
,
rev_target
)
self
.
assertSameSet
(
p1
-
f2
,
fwd_target
)
self
.
assertSameSet
(
p2
-
f1
,
rev_target
)
self
.
assertSameSet
(
f1
-
l2
,
fwd_target
)
self
.
assertSameSet
(
f2
-
l1
,
rev_target
)
target
=
r1
^
r2
self
.
assertSameSet
(
f1
^
f2
,
target
)
self
.
assertSameSet
(
f1
^
r2
,
target
)
self
.
assertSameSet
(
r2
^
f1
,
target
)
self
.
assertSameSet
(
f1
^
p2
,
target
)
self
.
assertSameSet
(
p2
^
f1
,
target
)
self
.
assertSameSet
(
f1
^
l2
,
target
)
# proper subset
self
.
assertTrue
(
f1
<
f3
)
self
.
assertFalse
(
f1
<
f1
)
self
.
assertFalse
(
f1
<
f2
)
self
.
assertTrue
(
r1
<
f3
)
self
.
assertFalse
(
r1
<
f1
)
self
.
assertFalse
(
r1
<
f2
)
self
.
assertTrue
(
r1
<
r3
)
self
.
assertFalse
(
r1
<
r1
)
self
.
assertFalse
(
r1
<
r2
)
with
test_support
.
check_py3k_warnings
():
# python 2 only, cross-type compares will succeed
f1
<
l3
f1
<
l1
f1
<
l2
# any subset
self
.
assertTrue
(
f1
<=
f3
)
self
.
assertTrue
(
f1
<=
f1
)
self
.
assertFalse
(
f1
<=
f2
)
self
.
assertTrue
(
r1
<=
f3
)
self
.
assertTrue
(
r1
<=
f1
)
self
.
assertFalse
(
r1
<=
f2
)
self
.
assertTrue
(
r1
<=
r3
)
self
.
assertTrue
(
r1
<=
r1
)
self
.
assertFalse
(
r1
<=
r2
)
with
test_support
.
check_py3k_warnings
():
# python 2 only, cross-type compares will succeed
f1
<=
l3
f1
<=
l1
f1
<=
l2
# proper superset
self
.
assertTrue
(
f3
>
f1
)
self
.
assertFalse
(
f1
>
f1
)
self
.
assertFalse
(
f2
>
f1
)
self
.
assertTrue
(
r3
>
r1
)
self
.
assertFalse
(
f1
>
r1
)
self
.
assertFalse
(
f2
>
r1
)
self
.
assertTrue
(
r3
>
r1
)
self
.
assertFalse
(
r1
>
r1
)
self
.
assertFalse
(
r2
>
r1
)
with
test_support
.
check_py3k_warnings
():
# python 2 only, cross-type compares will succeed
f1
>
l3
f1
>
l1
f1
>
l2
# any superset
self
.
assertTrue
(
f3
>=
f1
)
self
.
assertTrue
(
f1
>=
f1
)
self
.
assertFalse
(
f2
>=
f1
)
self
.
assertTrue
(
r3
>=
r1
)
self
.
assertTrue
(
f1
>=
r1
)
self
.
assertFalse
(
f2
>=
r1
)
self
.
assertTrue
(
r3
>=
r1
)
self
.
assertTrue
(
r1
>=
r1
)
self
.
assertFalse
(
r2
>=
r1
)
with
test_support
.
check_py3k_warnings
():
# python 2 only, cross-type compares will succeed
f1
>=
l3
f1
>=
l1
f1
>=
l2
# equality
self
.
assertTrue
(
f1
==
f1
)
self
.
assertTrue
(
r1
==
f1
)
self
.
assertTrue
(
f1
==
r1
)
self
.
assertFalse
(
f1
==
f3
)
self
.
assertFalse
(
r1
==
f3
)
self
.
assertFalse
(
f1
==
r3
)
# python 2 only, cross-type compares will succeed
f1
==
l3
f1
==
l1
f1
==
l2
# inequality
self
.
assertFalse
(
f1
!=
f1
)
self
.
assertFalse
(
r1
!=
f1
)
self
.
assertFalse
(
f1
!=
r1
)
self
.
assertTrue
(
f1
!=
f3
)
self
.
assertTrue
(
r1
!=
f3
)
self
.
assertTrue
(
f1
!=
r3
)
# python 2 only, cross-type compares will succeed
f1
!=
l3
f1
!=
l1
f1
!=
l2
self
.
assertFalse
(
ncs
<
cs
)
self
.
assertFalse
(
ncs
<=
cs
)
self
.
assertFalse
(
cs
>
ncs
)
self
.
assertFalse
(
cs
>=
ncs
)
def
test_Mapping
(
self
):
for
sample
in
[
dict
]:
...
...
@@ -906,28 +731,6 @@ class TestCounter(unittest.TestCase):
self
.
assertEqual
(
c
.
setdefault
(
'e'
,
5
),
5
)
self
.
assertEqual
(
c
[
'e'
],
5
)
def
test_init
(
self
):
self
.
assertEqual
(
list
(
Counter
(
self
=
42
).
items
()),
[(
'self'
,
42
)])
self
.
assertEqual
(
list
(
Counter
(
iterable
=
42
).
items
()),
[(
'iterable'
,
42
)])
self
.
assertEqual
(
list
(
Counter
(
iterable
=
None
).
items
()),
[(
'iterable'
,
None
)])
self
.
assertRaises
(
TypeError
,
Counter
,
42
)
self
.
assertRaises
(
TypeError
,
Counter
,
(),
())
self
.
assertRaises
(
TypeError
,
Counter
.
__init__
)
def
test_update
(
self
):
c
=
Counter
()
c
.
update
(
self
=
42
)
self
.
assertEqual
(
list
(
c
.
items
()),
[(
'self'
,
42
)])
c
=
Counter
()
c
.
update
(
iterable
=
42
)
self
.
assertEqual
(
list
(
c
.
items
()),
[(
'iterable'
,
42
)])
c
=
Counter
()
c
.
update
(
iterable
=
None
)
self
.
assertEqual
(
list
(
c
.
items
()),
[(
'iterable'
,
None
)])
self
.
assertRaises
(
TypeError
,
Counter
().
update
,
42
)
self
.
assertRaises
(
TypeError
,
Counter
().
update
,
{},
{})
self
.
assertRaises
(
TypeError
,
Counter
.
update
)
def
test_copying
(
self
):
# Check that counters are copyable, deepcopyable, picklable, and
#have a repr/eval round-trip
...
...
@@ -1029,16 +832,6 @@ class TestCounter(unittest.TestCase):
c
.
subtract
(
'aaaabbcce'
)
self
.
assertEqual
(
c
,
Counter
(
a
=-
1
,
b
=
0
,
c
=-
1
,
d
=
1
,
e
=-
1
))
c
=
Counter
()
c
.
subtract
(
self
=
42
)
self
.
assertEqual
(
list
(
c
.
items
()),
[(
'self'
,
-
42
)])
c
=
Counter
()
c
.
subtract
(
iterable
=
42
)
self
.
assertEqual
(
list
(
c
.
items
()),
[(
'iterable'
,
-
42
)])
self
.
assertRaises
(
TypeError
,
Counter
().
subtract
,
42
)
self
.
assertRaises
(
TypeError
,
Counter
().
subtract
,
{},
{})
self
.
assertRaises
(
TypeError
,
Counter
.
subtract
)
class
TestOrderedDict
(
unittest
.
TestCase
):
def
test_init
(
self
):
...
...
@@ -1052,11 +845,8 @@ class TestOrderedDict(unittest.TestCase):
c
=
3
,
e
=
5
).
items
()),
pairs
)
# mixed input
# make sure no positional args conflict with possible kwdargs
self
.
assertEqual
(
list
(
OrderedDict
(
self
=
42
).
items
()),
[(
'self'
,
42
)])
self
.
assertEqual
(
list
(
OrderedDict
(
other
=
42
).
items
()),
[(
'other'
,
42
)])
self
.
assertRaises
(
TypeError
,
OrderedDict
,
42
)
self
.
assertRaises
(
TypeError
,
OrderedDict
,
(),
())
self
.
assertRaises
(
TypeError
,
OrderedDict
.
__init__
)
self
.
assertEqual
(
inspect
.
getargspec
(
OrderedDict
.
__dict__
[
'__init__'
]).
args
,
[
'self'
])
# Make sure that direct calls to __init__ do not clear previous contents
d
=
OrderedDict
([(
'a'
,
1
),
(
'b'
,
2
),
(
'c'
,
3
),
(
'd'
,
44
),
(
'e'
,
55
)])
...
...
@@ -1101,10 +891,6 @@ class TestOrderedDict(unittest.TestCase):
self
.
assertEqual
(
list
(
d
.
items
()),
[(
'a'
,
1
),
(
'b'
,
2
),
(
'c'
,
3
),
(
'd'
,
4
),
(
'e'
,
5
),
(
'f'
,
6
),
(
'g'
,
7
)])
self
.
assertRaises
(
TypeError
,
OrderedDict
().
update
,
42
)
self
.
assertRaises
(
TypeError
,
OrderedDict
().
update
,
(),
())
self
.
assertRaises
(
TypeError
,
OrderedDict
.
update
)
def
test_abc
(
self
):
self
.
assertIsInstance
(
OrderedDict
(),
MutableMapping
)
self
.
assertTrue
(
issubclass
(
OrderedDict
,
MutableMapping
))
...
...
test/CPYTHON_TEST_NOTES.md
View file @
240a82f6
...
...
@@ -17,7 +17,6 @@ The CPython tests I've included fail for various reasons. Recurring issues inclu
```
FILE REASONS
------------------------------------------------------
test_abc [unknown]
test_aepack No module named aetypes
test_aifc Unsupported subclassing from file?
test_al No module named al
...
...
@@ -56,7 +55,6 @@ test_codeop [unknown]
test_code [unknown]
test_coding works when run from inside the from_cpython dir
test_coercion 1**1L, divmod(1, 1L); some unknown bug
test_collections assertion failed when doing vars(collections.namedtuple('Point', 'x y')(11, 12))
test_compileall [unknown]
test_compiler [unknown]
test_compile [unknown]
...
...
@@ -207,7 +205,7 @@ test_uuid segfault in ctypes (but only on CI)
test_wait3 [unknown]
test_wait4 [unknown]
test_warnings [unknown]
test_weakref weird function-picking bug (something around float.__add__)
test_weakref weird function-picking bug (something around float.__add__)
, plase also fix the weakref issue in test_abc
test_weakset unknown issues
test_winreg [unknown]
test_winsound [unknown]
...
...
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