summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/int-divzero.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-31 02:20:00 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-31 02:23:57 +0300
commit6ded55a61f6bbf007d518fc4531287de08fe51c4 (patch)
treef78ee04bd9636bea80d6b63d86f8044c76fdb17a /tests/basics/int-divzero.py
parent96ed213320cb627c1df7ea8550b86b0bba5cb559 (diff)
downloadmicropython-6ded55a61f6bbf007d518fc4531287de08fe51c4.tar.gz
micropython-6ded55a61f6bbf007d518fc4531287de08fe51c4.zip
py: Properly implement divide-by-zero handling.
"1/0" is sacred idiom, the shortest way to break program execution (sys.exit() is too long).
Diffstat (limited to 'tests/basics/int-divzero.py')
-rw-r--r--tests/basics/int-divzero.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/basics/int-divzero.py b/tests/basics/int-divzero.py
new file mode 100644
index 0000000000..d1fc579321
--- /dev/null
+++ b/tests/basics/int-divzero.py
@@ -0,0 +1,9 @@
+try:
+ 1 / 0
+except ZeroDivisionError:
+ print("ZeroDivisionError")
+
+try:
+ 1 // 0
+except ZeroDivisionError:
+ print("ZeroDivisionError")