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
da5d8d00
Commit
da5d8d00
authored
Sep 30, 2015
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable test_set and add more tests to set.py
parent
a9118c1d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
4 deletions
+57
-4
from_cpython/Lib/test/test_set.py
from_cpython/Lib/test/test_set.py
+6
-4
test/tests/set.py
test/tests/set.py
+51
-0
No files found.
from_cpython/Lib/test/test_set.py
View file @
da5d8d00
# expected: fail
import
unittest
import
unittest
from
test
import
test_support
from
test
import
test_support
import
gc
import
gc
...
@@ -339,7 +337,9 @@ class TestJointOps(unittest.TestCase):
...
@@ -339,7 +337,9 @@ class TestJointOps(unittest.TestCase):
obj
.
x
=
iter
(
container
)
obj
.
x
=
iter
(
container
)
del
obj
,
container
del
obj
,
container
gc
.
collect
()
gc
.
collect
()
self
.
assertTrue
(
ref
()
is
None
,
"Cycle was not collected"
)
# Pyston change: because with conservative scanning
# it is hard to guarantee finalizer calls
# self.assertTrue(ref() is None, "Cycle was not collected")
class
TestSet
(
TestJointOps
):
class
TestSet
(
TestJointOps
):
thetype
=
set
thetype
=
set
...
@@ -560,7 +560,9 @@ class TestSet(TestJointOps):
...
@@ -560,7 +560,9 @@ class TestSet(TestJointOps):
p
=
weakref
.
proxy
(
s
)
p
=
weakref
.
proxy
(
s
)
self
.
assertEqual
(
str
(
p
),
str
(
s
))
self
.
assertEqual
(
str
(
p
),
str
(
s
))
s
=
None
s
=
None
self
.
assertRaises
(
ReferenceError
,
str
,
p
)
# Pyston change: because with conservative scanning
# it is hard to guarantee finalizer calls
# self.assertRaises(ReferenceError, str, p)
@
unittest
.
skipUnless
(
hasattr
(
set
,
"test_c_api"
),
@
unittest
.
skipUnless
(
hasattr
(
set
,
"test_c_api"
),
'C API test only available in a debug build'
)
'C API test only available in a debug build'
)
...
...
test/tests/set.py
View file @
da5d8d00
...
@@ -199,3 +199,54 @@ try:
...
@@ -199,3 +199,54 @@ try:
set
(
**
dict
(
a
=
1
))
set
(
**
dict
(
a
=
1
))
except
TypeError
:
except
TypeError
:
print
"TypeError"
print
"TypeError"
class
MySet
(
set
):
def
__new__
(
cls
,
*
args
,
**
kwargs
):
return
set
.
__new__
(
cls
,
*
args
)
try
:
MySet
(
a
=
1
)
except
TypeError
as
e
:
print
(
e
.
message
)
class
SetSubclassWithKeywordArgs
(
set
):
def
__init__
(
self
,
iterable
=
[],
newarg
=
None
):
set
.
__init__
(
self
,
iterable
)
SetSubclassWithKeywordArgs
(
newarg
=
1
)
try
:
frozenset
(
a
=
1
)
except
TypeError
as
e
:
print
(
e
.
message
)
class
MyFrozenSet
(
frozenset
):
def
__new__
(
cls
,
*
args
,
**
kwargs
):
return
frozenset
.
__new__
(
cls
,
*
args
)
MyFrozenSet
(
a
=
1
)
class
FrozensetSubclassWithKeywordArgs
(
frozenset
):
def
__init__
(
self
,
iterable
=
[],
newarg
=
None
):
frozenset
.
__init__
(
self
,
iterable
)
FrozensetSubclassWithKeywordArgs
(
newarg
=
1
)
print
(
set
()
in
frozenset
([
frozenset
()]))
class
MySet
(
set
):
def
__hash__
(
self
):
print
(
"calling __hash__"
)
return
id
(
self
)
print
(
"Ready"
)
foo
=
MySet
()
a
=
set
()
a
.
add
(
foo
)
print
(
a
.
remove
(
foo
))
print
(
foo
in
set
())
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