diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-12 21:40:58 -0700 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-12 21:40:58 -0700 |
| commit | 75ad12a5bd102cf3185e1919f47468ef48135536 (patch) | |
| tree | 25fe3f25145f6523f3c33a9abd2dc722f8ed2849 /nbs/test.ipynb | |
| parent | Clean up unused imports in cli (diff) | |
| download | nb-wip.zip | |
wipwip
Diffstat (limited to 'nbs/test.ipynb')
| -rw-r--r-- | nbs/test.ipynb | 135 |
1 files changed, 93 insertions, 42 deletions
diff --git a/nbs/test.ipynb b/nbs/test.ipynb index 5f8aafb..0e1095b 100644 --- a/nbs/test.ipynb +++ b/nbs/test.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "d42a9120-8d70-4b10-8d6c-b59692fd03ad", "metadata": {}, "outputs": [], @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "11cb390f-b0f4-438d-b524-db7242d22ee9", "metadata": {}, "outputs": [], @@ -24,7 +24,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "dd03783f-252c-40f5-b92f-0f3f9278ce09", "metadata": {}, "outputs": [], @@ -37,7 +37,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "2cf5d527", "metadata": {}, "outputs": [], @@ -85,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "058c5afe", "metadata": {}, "outputs": [ @@ -96,6 +96,7 @@ " 'f_back',\n", " 'f_builtins',\n", " 'f_code',\n", + " 'f_generator',\n", " 'f_globals',\n", " 'f_lasti',\n", " 'f_lineno',\n", @@ -105,7 +106,7 @@ " 'f_trace_opcodes']" ] }, - "execution_count": null, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -124,7 +125,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "28ec6212", "metadata": {}, "outputs": [], @@ -135,7 +136,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "a7fa576a", "metadata": {}, "outputs": [], @@ -151,7 +152,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "f2088db2", "metadata": {}, "outputs": [ @@ -161,7 +162,7 @@ "[' caller_fm = f(\\n']" ] }, - "execution_count": null, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -172,7 +173,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "c463da2f", "metadata": {}, "outputs": [ @@ -182,7 +183,7 @@ "Positions(lineno=2, end_lineno=7, col_offset=16, end_col_offset=5)" ] }, - "execution_count": null, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -211,7 +212,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "cde6030a", "metadata": {}, "outputs": [ @@ -227,7 +228,7 @@ " ' )\\n']" ] }, - "execution_count": null, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -239,7 +240,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "022f2436", "metadata": {}, "outputs": [ @@ -254,7 +255,7 @@ " ' )\\n']" ] }, - "execution_count": null, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -274,7 +275,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "a2c3f459", "metadata": {}, "outputs": [ @@ -284,7 +285,7 @@ "'f'" ] }, - "execution_count": null, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -295,7 +296,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "5a7d9955", "metadata": {}, "outputs": [ @@ -305,7 +306,7 @@ "'\\n'" ] }, - "execution_count": null, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -316,7 +317,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "c30f907f", "metadata": {}, "outputs": [ @@ -326,7 +327,7 @@ "'f(\\n 1+1,\\n 2,\\n max(5, 2),\\n a=2,\\n )'" ] }, - "execution_count": null, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -352,7 +353,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "54df1747", "metadata": {}, "outputs": [ @@ -362,7 +363,7 @@ "['1 + 1', '2', 'max(5, 2)']" ] }, - "execution_count": null, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -374,7 +375,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "ee5cb9e8", "metadata": {}, "outputs": [ @@ -384,7 +385,7 @@ "{'a': '2'}" ] }, - "execution_count": null, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -404,7 +405,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "a6c67919", "metadata": {}, "outputs": [], @@ -444,7 +445,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "bbe2859c", "metadata": {}, "outputs": [ @@ -471,7 +472,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "1f3b1abb", "metadata": {}, "outputs": [], @@ -491,7 +492,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "b7730389", "metadata": {}, "outputs": [], @@ -502,7 +503,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "id": "19890aa0", "metadata": {}, "outputs": [], @@ -522,7 +523,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "b8b7195c", "metadata": {}, "outputs": [], @@ -547,7 +548,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "id": "ce0666f5", "metadata": {}, "outputs": [], @@ -560,7 +561,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "id": "3555f6cf", "metadata": {}, "outputs": [], @@ -580,7 +581,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "id": "2a42fc2b", "metadata": {}, "outputs": [], @@ -593,7 +594,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "b3687819", "metadata": {}, "outputs": [], @@ -621,7 +622,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "id": "623a480c", "metadata": {}, "outputs": [], @@ -636,7 +637,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "id": "0ad5fcef-f04d-469d-8ad1-94d3a98694e4", "metadata": {}, "outputs": [], @@ -664,7 +665,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "id": "7c478098-7a09-403c-a62b-3c34cf0f7bab", "metadata": {}, "outputs": [], @@ -687,7 +688,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 62, "id": "10ba9dcd", "metadata": {}, "outputs": [], @@ -710,7 +711,9 @@ " lines = [f'{a_src} {negstr} {b_src}']\n", " if len(args_src) > 0 and a_repr != args_src[0]: lines.append(f' where {args_src[0]} = {a_repr}')\n", " if len(args_src) > 1 and b_repr != args_src[1]: lines.append(f' where {args_src[1]} = {b_repr}')\n", - " assert cmp(a, b), \"\\n\".join(lines)" + " if not cmp(a, b):\n", + " print(sys.exc_info())\n", + " raise AssertionError(\"\\n\".join(lines)).with_traceback(None)" ] }, { @@ -723,6 +726,36 @@ }, { "cell_type": "code", + "execution_count": 63, + "id": "5717b8a6-8bfc-49f6-84a3-79a6d7b147c6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(None, None, None)\n" + ] + }, + { + "ename": "AssertionError", + "evalue": "1 not eq 2", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mAssertionError\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[63]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m expect(\u001b[32m1\u001b[39m, \u001b[32m2\u001b[39m, operator.eq)\n", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[62]\u001b[39m\u001b[32m, line 21\u001b[39m, in \u001b[36mexpect\u001b[39m\u001b[34m(a, b, cmp, negstr, frames_up, truncate)\u001b[39m\n\u001b[32m 17\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m len(args_src) > \u001b[32m0\u001b[39m \u001b[38;5;28;01mand\u001b[39;00m a_repr != args_src[\u001b[32m0\u001b[39m]: lines.append(f' where {args_src[\u001b[32m0\u001b[39m]} = {a_repr}')\n\u001b[32m 18\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m len(args_src) > \u001b[32m1\u001b[39m \u001b[38;5;28;01mand\u001b[39;00m b_repr != args_src[\u001b[32m1\u001b[39m]: lines.append(f' where {args_src[\u001b[32m1\u001b[39m]} = {b_repr}')\n\u001b[32m 19\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28;01mnot\u001b[39;00m cmp(a, b):\n\u001b[32m 20\u001b[39m print(sys.exc_info())\n\u001b[32m---> \u001b[39m\u001b[32m21\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m AssertionError(\u001b[33m\"\\n\"\u001b[39m.join(lines)).with_traceback(\u001b[38;5;28;01mNone\u001b[39;00m)\n", + "\u001b[31mAssertionError\u001b[39m: 1 not eq 2" + ] + } + ], + "source": [ + "expect(1, 2, operator.eq)" + ] + }, + { + "cell_type": "code", "execution_count": null, "id": "19d62642", "metadata": {}, @@ -1162,7 +1195,25 @@ ] } ], - "metadata": {}, + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.14.4" + } + }, "nbformat": 4, "nbformat_minor": 5 } |