Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
d690c2e1
Commit
d690c2e1
authored
Aug 29, 2018
by
Paul Sokolovsky
Committed by
Damien George
Dec 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests/basics/special_methods: Add testcases for __int__.
parent
b1d08726
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
tests/basics/special_methods.py
tests/basics/special_methods.py
+14
-0
No files found.
tests/basics/special_methods.py
View file @
d690c2e1
...
...
@@ -93,6 +93,9 @@ class Cud():
print
(
"__isub__ called"
)
return
self
def
__int__
(
self
):
return
42
cud1
=
Cud
()
cud2
=
Cud
()
...
...
@@ -104,5 +107,16 @@ cud1 >= cud2
cud1
>
cud2
cud1
+
cud2
cud1
-
cud2
print
(
int
(
cud1
))
class
BadInt
:
def
__int__
(
self
):
print
(
"__int__ called"
)
return
None
try
:
int
(
BadInt
())
except
TypeError
:
print
(
"TypeError"
)
# more in special_methods2.py
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