Skip to content

Commit 0a87daa

Browse files
committed
Add call to test function
1 parent 54c64a2 commit 0a87daa

File tree

1 file changed

+119
-19
lines changed

1 file changed

+119
-19
lines changed

Diff for: source-code/testing/Hypothesis/simple_hypothesis.ipynb

+119-19
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 36,
15+
"execution_count": 2,
1616
"metadata": {},
1717
"outputs": [],
1818
"source": [
@@ -25,7 +25,7 @@
2525
},
2626
{
2727
"cell_type": "code",
28-
"execution_count": 32,
28+
"execution_count": 3,
2929
"metadata": {},
3030
"outputs": [],
3131
"source": [
@@ -38,7 +38,7 @@
3838
},
3939
{
4040
"cell_type": "code",
41-
"execution_count": null,
41+
"execution_count": 4,
4242
"metadata": {},
4343
"outputs": [],
4444
"source": [
@@ -51,7 +51,98 @@
5151
},
5252
{
5353
"cell_type": "code",
54-
"execution_count": 39,
54+
"execution_count": 5,
55+
"metadata": {},
56+
"outputs": [
57+
{
58+
"name": "stdout",
59+
"output_type": "stream",
60+
"text": [
61+
"2\n",
62+
"0\n",
63+
"22\n",
64+
"3\n",
65+
"34\n",
66+
"4\n",
67+
"38\n",
68+
"14\n",
69+
"43\n",
70+
"47\n",
71+
"15\n",
72+
"32\n",
73+
"13\n",
74+
"13\n",
75+
"4\n",
76+
"49\n",
77+
"8\n",
78+
"8\n",
79+
"24\n",
80+
"5\n",
81+
"7\n",
82+
"42\n",
83+
"11\n",
84+
"11\n",
85+
"25\n",
86+
"28\n",
87+
"12\n",
88+
"12\n",
89+
"12\n",
90+
"0\n",
91+
"0\n",
92+
"0\n",
93+
"26\n",
94+
"27\n",
95+
"19\n",
96+
"20\n",
97+
"29\n",
98+
"33\n",
99+
"17\n",
100+
"50\n",
101+
"35\n",
102+
"46\n",
103+
"21\n",
104+
"36\n",
105+
"36\n",
106+
"37\n",
107+
"48\n",
108+
"31\n",
109+
"21\n",
110+
"19\n",
111+
"16\n",
112+
"41\n",
113+
"40\n",
114+
"26\n",
115+
"49\n",
116+
"49\n",
117+
"49\n",
118+
"49\n",
119+
"30\n",
120+
"44\n",
121+
"18\n",
122+
"18\n",
123+
"39\n",
124+
"8\n",
125+
"8\n",
126+
"48\n",
127+
"26\n",
128+
"23\n",
129+
"6\n",
130+
"2\n",
131+
"1\n",
132+
"45\n",
133+
"9\n",
134+
"9\n",
135+
"10\n"
136+
]
137+
}
138+
],
139+
"source": [
140+
"test_fac()"
141+
]
142+
},
143+
{
144+
"cell_type": "code",
145+
"execution_count": 6,
55146
"metadata": {},
56147
"outputs": [],
57148
"source": [
@@ -64,7 +155,7 @@
64155
},
65156
{
66157
"cell_type": "code",
67-
"execution_count": 40,
158+
"execution_count": 7,
68159
"metadata": {},
69160
"outputs": [
70161
{
@@ -73,12 +164,21 @@
73164
"text": [
74165
"3 6\n",
75166
"0 0\n",
76-
"-6944 78\n",
77-
"31477 16805\n",
78-
"-18797 -5249650399981005968421445188500497788\n",
79-
"-23 19818\n",
80-
"1123842389 -30224\n",
81-
"You can add @seed(67642884424563202271431124669201687250) to this test to reproduce this failure.\n"
167+
"20572 -1490998015\n",
168+
"20572 -1348217635\n",
169+
"20572 3\n",
170+
"20572 -814\n",
171+
"-814 -814\n",
172+
"-814 -814\n",
173+
"-2624110112850083942625652491078322126 69\n",
174+
"-2624110112850083942625652491078322126 -2624110112850083942625652491078322126\n",
175+
"-30962 165500787292363604581876376573135435158\n",
176+
"0 0\n",
177+
"0 22\n",
178+
"0 0\n",
179+
"0 523\n",
180+
"0 0\n",
181+
"243746923213 -6\n"
82182
]
83183
},
84184
{
@@ -88,11 +188,11 @@
88188
"traceback": [
89189
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
90190
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
91-
"\u001b[0;32m<ipython-input-40-b86001e5f435>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtest_specific\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
92-
"\u001b[0;32m<ipython-input-39-68fbe48d870b>\u001b[0m in \u001b[0;36mtest_specific\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mgiven\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mst\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mintegers\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mst\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mintegers\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;34m@\u001b[0m\u001b[0mexample\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m6\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mtest_specific\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mfac\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
93-
"\u001b[0;32m~/miniconda3/envs/py37/lib/python3.7/site-packages/hypothesis/core.py\u001b[0m in \u001b[0;36mwrapped_test\u001b[0;34m(*arguments, **kwargs)\u001b[0m\n\u001b[1;32m 1022\u001b[0m \u001b[0mget_trimmed_traceback\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1023\u001b[0m )\n\u001b[0;32m-> 1024\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mthe_error_hypothesis_found\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1025\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1026\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mattrib\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mdir\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
94-
"\u001b[0;32m<ipython-input-39-68fbe48d870b>\u001b[0m in \u001b[0;36mtest_specific\u001b[0;34m(input, output)\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mtest_specific\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0;32massert\u001b[0m \u001b[0mfac\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
95-
"\u001b[0;32m<ipython-input-36-527bad9e8bd3>\u001b[0m in \u001b[0;36mfac\u001b[0;34m(n)\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mprod\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mn\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mprod\u001b[0m \u001b[0;34m*=\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mprod\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
191+
"Cell \u001b[0;32mIn[7], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mtest_specific\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
192+
"Cell \u001b[0;32mIn[6], line 2\u001b[0m, in \u001b[0;36mtest_specific\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;129m@given\u001b[39m(\u001b[38;5;28minput\u001b[39m\u001b[38;5;241m=\u001b[39mst\u001b[38;5;241m.\u001b[39mintegers(), output\u001b[38;5;241m=\u001b[39mst\u001b[38;5;241m.\u001b[39mintegers())\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;129m@example\u001b[39m(\u001b[38;5;28minput\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m3\u001b[39m, output\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m6\u001b[39m)\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mtest_specific\u001b[39m(\u001b[38;5;28minput\u001b[39m, output):\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28minput\u001b[39m, output)\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m fac(\u001b[38;5;28minput\u001b[39m) \u001b[38;5;241m==\u001b[39m output\n",
193+
" \u001b[0;31m[... skipping hidden 1 frame]\u001b[0m\n",
194+
"Cell \u001b[0;32mIn[6], line 5\u001b[0m, in \u001b[0;36mtest_specific\u001b[0;34m(input, output)\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;129m@given\u001b[39m(\u001b[38;5;28minput\u001b[39m\u001b[38;5;241m=\u001b[39mst\u001b[38;5;241m.\u001b[39mintegers(), output\u001b[38;5;241m=\u001b[39mst\u001b[38;5;241m.\u001b[39mintegers())\n\u001b[1;32m 2\u001b[0m \u001b[38;5;129m@example\u001b[39m(\u001b[38;5;28minput\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m3\u001b[39m, output\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m6\u001b[39m)\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mtest_specific\u001b[39m(\u001b[38;5;28minput\u001b[39m, output):\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28minput\u001b[39m, output)\n\u001b[0;32m----> 5\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[43mfac\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;241m==\u001b[39m output\n",
195+
"Cell \u001b[0;32mIn[2], line 4\u001b[0m, in \u001b[0;36mfac\u001b[0;34m(n)\u001b[0m\n\u001b[1;32m 2\u001b[0m prod \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;241m2\u001b[39m, n \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m1\u001b[39m):\n\u001b[0;32m----> 4\u001b[0m \u001b[43mprod\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mi\u001b[49m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m prod\n",
96196
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
97197
]
98198
}
@@ -118,7 +218,7 @@
118218
],
119219
"metadata": {
120220
"kernelspec": {
121-
"display_name": "Python 3",
221+
"display_name": "Python 3 (ipykernel)",
122222
"language": "python",
123223
"name": "python3"
124224
},
@@ -132,9 +232,9 @@
132232
"name": "python",
133233
"nbconvert_exporter": "python",
134234
"pygments_lexer": "ipython3",
135-
"version": "3.7.3"
235+
"version": "3.12.3"
136236
}
137237
},
138238
"nbformat": 4,
139-
"nbformat_minor": 2
239+
"nbformat_minor": 4
140240
}

0 commit comments

Comments
 (0)