Posts

Showing posts from October, 2018

working on manual tests for the Python Ternary Search Tree

Image
Hello peoples! This one will be about how I prepare to write a unittest/pytest. I know there's the whole 'test first' approach, but this works best for me so far. If it's not your thing, groovy. TODO: 1) make unittest  (started: see below) 2) compare pytest (started: see below) So far it looks like there is no advantage, other than some extra typing practice, to doing Unittest over pytest Update: adding the started unittest and pytest The Ternary search tree for this exercise in the LMPTHW book may be protected by Zed's copyright, so I shall instead share some testing techniques I am working on. I want to do a unittest for this exercise, because well....  Most testing libraries are built on top of the already built in unittest that python has. Instead of fumbling to write out the tests for pytest / unittest; I first write out the different print calls I'd like to see; Then I'll write the unittest or pytest around what I would like to see

Python Ellipsis

Image
I ran across this oddity experimenting with getting the locals() to print from a for loop. a stack overflow reference I used for help: https://stackoverflow.com/questions/26544091/checking-if-type-list-in-python I don't know if I'll get through it tonight to explain, or figure it out, maybe tomorrow. But, check it out. Curious. Lets break it! Update 12/22/2020: The three dots [...] Ellipsis, are a python placeholder for a big list of items... basically.  Here's A stackoverflow link with more eloquent answers: StackOverFlow Python Ellipsis UPDATE 10/9/18 below I asked about this in the LearnCodeTheHardWay forum to see if I could get suggestions how to decipher this. On suggestion, I ran some profile tests on two separate codes. What I really want to know is WTH is that [...] called, and what is python doing there? Picture & Code for test on the size 1 million for loop locals() list: ** 1.993 seconds *** Code: #!usr/bin/python3