Notebooks and Spreadsheets often lack test assertions; which are critical to quality
"Spreadsheet errors can have disastrous consequences – yet we keep making them" (2024) https://news.ycombinator.com/item?id=39132512 """ What are some Software Development methods for reducing errors: 1. AUTOMATED TESTS; test assertions To write spreadsheet tests: A. Write your own test assertion library for their macro language; write assertEqual() in VBscript and Apps Script. B. Use another language with a test library and a test runner; e.g. Python and the `assert` keyword, unittest.TestCase().assertEqual() or pytest. C. Test the spreadsheet GUI with something like AutoHotKey. >From https://news.ycombinator.com/item?id=35896192 : > The Scientific Method is testing, so testing (tests, assertions, fixtures) should be core to any scientific workflow system. > awesome-jupyter#testing: https://github.com/markusschanta/awesome-jupyter#testing > ml-tooling/best-of-jupyter lists papermill/papermill under "Interactive Widgets/Visualization" https://github.com/ml-tooling/best-of-jupyter#interactive-wi... """ TIL about K-16: - K12CS: K-12 CS - Q12: Quantum K12 - P-12: Pre-K - 12 Exercise: - 1. Khanmigo > Tutoring help in Math > ~ask for review questions in [addition of 3 digit numbers] - 2. Create a notebook in e.g. JupyterLite. This is in the "percent format" that jupytext and various other IDEs support. `# %%` is the input cell delimiter: ```python # %% 321+123 # %% x = 321 y = 321 + 123 print([x, y]) # %% assert 321 + 123 == 444 assert 444 - 321 == 123 # %% import unittest; test = unittest.TestCase() test.assertEqual(321+123, 444) test.assertEqual(444-321, 123) test.assertEqual(444-123, 321) # %% test_cases = [ [1,2, 3], [123, 321, 444], [100, 214, 314], #[1, 2, 5] ] for a,b,c in test_cases: test.assertEqual(a+b, c) test.assertEqual(c-b, a) test.assertEqual(c-a, b) # %% print([a, b, c]) print(f"Hello World: {x} + {y} = {z}") ``` ; Test assertions for Science On Thu, Jan 25, 2024, 7:43 PM kirby urner <kirby.ur...@gmail.com> wrote: > > Thanks for jumping in David. > > I concur, the Excel environment is a productive "home base" for deriving > the visualizations and is in many cases is sufficient. > > In the Office model, one is then expected to embed said visualizations in > a Word document, perhaps exporting to PDF, if wanting to add more verbiage > and/or make it more journal article or textbook like. [1] > > In your type of advocacy work, maybe getting the visualizations is > sufficient, and indeed, the final step from Jupyter Notebook to a PDF > version is sometimes the trickiest, when it comes to page breaks especially. > > Here's a Notebook in the same ballpark, dealing with the half life of > naturally occurring and/or artificially generated radioactive substances: > > > https://nbviewer.org/github/4dsolutions/School_of_Tomorrow/blob/master/isotope_decay.ipynb > > This is the classic synergy of Jupyter + pandas + matplotlib, the kind of > thing I've been teaching through a Turkey-based company. [2] > > I don't see it as either / or, and true, Jupyter might be the wrong tool > in many instances. I wonder if you've had a chance to play with pandas > inside of Excel. I know Microsoft has added that. > > I've yet to try it out (currently, I don't have a computer with Office at > my fingertips). > > Kirby > > PS: in my previous post I had a typo buried in the most mathy part, which > I've since fixed on Github. > https://groups.io/g/synergeo/message/2481 > > [1] > https://www.theatlantic.com/science/archive/2018/04/the-scientific-paper-is-obsolete/556676/ > (Atlantic has implemented more of a firewall then previously -- the > article is about Wolfram's Mathematica as well as Jupyter) > > [2] > https://nbviewer.org/github/4dsolutions/clarusway_data_analysis/blob/main/DAwPy_S1_%28Numpy_Arrays%29/daily_schedule.ipynb > > > > On Thu, Jan 25, 2024 at 1:18 PM David MacQuigg <macqu...@gmail.com> wrote: > >> Hello Kirby >> >> Jupyter is excellent, but I still wish there was a simple built-in >> charting tool in Python. Jupyter is like Sketchup, a tool I use once a >> year, but not enough to justify keeping up on it. >> >> My work now is focused on nuclear power >> <https://citizendium.org/wiki/Nuclear_power_reconsidered>, and educating >> journalists who might break with the mainstream and need a good summary of >> facts and arguments. That occasionally requires me to make a quick >> calculation and plot, and I find myself using Google Sheets instead of >> Python. Here is an example on Separative Work Units, the fundamental >> measure of cost in uranium enrichment. Once you get the calculation worked >> out, the plot is just a few more clicks. >> >> https://docs.google.com/spreadsheets/d/1OyKPyjo6k1ckZVwAh8sfkDEtB5W22VUriBaelK3LWY4/edit?usp=sharing >> >> David MacQuigg, PhD >> Engineering Editor, Citizendium >> 520-721-4583 >> > > > > _______________________________________________ > Edu-sig mailing list -- edu-sig@python.org > To unsubscribe send an email to edu-sig-le...@python.org > https://mail.python.org/mailman3/lists/edu-sig.python.org/ > Member address: wes.tur...@gmail.com >
_______________________________________________ Edu-sig mailing list -- edu-sig@python.org To unsubscribe send an email to edu-sig-le...@python.org https://mail.python.org/mailman3/lists/edu-sig.python.org/ Member address: arch...@mail-archive.com