We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a74f599 commit e71b960Copy full SHA for e71b960
Examples/week-08-extensions/c-api/divide/divide.c
@@ -27,4 +27,3 @@ initdivide(void) {
27
28
Py_InitModule("divide", DivideMethods);
29
}
30
-
Examples/week-08-extensions/c-api/divide/test_divide.py
@@ -0,0 +1,17 @@
1
+"""
2
+test file for the divide function
3
4
+
5
+import pytest
6
7
+from divide import divide
8
9
10
+def test_divide():
11
+ assert divide(3, 4) == 0.75
12
13
14
+def test_divide_zero():
15
+ # if it acts like python, it should raise an exception
16
+ with pytest.raises(ZeroDivisionError):
17
+ divide(3, 0)
0 commit comments