useless testing a boolean in python

I realize this might be pointless.... but I thought I'd try it.
Did something similar in JAVA,  going to test it some more and see what I get.

update:
Got some help from some of my LPTHW JCDP peeps!
Seriously, I am so thankful to be a part of this group!
I can still work on it, make it do more, but I got to go to bed!!
and... it didn't copy the indents again.... bah.

update:
this is apparently useless, there is a whole part of python for testing stuff.  Good for me though, this is how I learn.  
https://docs.python.org/3/library/unittest.html
A youtube video I watched most of at the gym today all about it:
https://www.youtube.com/watch?v=6tNS--WetLI

update:
Below the original,  I have the test I got to work using the video above.  I'll put the two files I used.

update: 9-1-19 ,  Going through my old blog posts and fixing the code formatting by moving old code into the code editor:  Find_all, Replace_all the html code with blank spaces.  Then add to the blogger:
<pre><code>  PASTE CLEAN CODE IN HERE </code></pre>  To get it looking better. You can add style in there to in the <code style="font-family: monospace;">  if you like.   The older posts I'm just cleaning up, newer posts have some styling added to code sections.


import  sys 
  
def test_bool( arg ):  
    test =  'false'   
    testing = arg   
    if  testing ==  True :  
       test = 'true' 
    return  test
 
 
 
 
def test_bool_broken ( method ):  
    test =  'false'   
    testing = method  
    if  testing ==  True :  
        test =  'true'  
    return test

a = 'true'
print ( f"testing  {a}  : " )  
print (test_bool(a)) 
b =  3 
print ( f"testing  {b}  : " )  
print (test_bool(b))  
c =  'apple'  ==  'apple'  
print ( f"testing  {c} :  " ) 
print (test_bool(c))  
 
def   test_method ( arg ):  
   apples =  20   
   results =  False   
   if  arg == apples:  
     results =  True   
   return  results 
 
 
 
 
 
def   broken_test_method ( arg ):  
    oranges =  10   
    apple = arg  
    results =  True   
    print ( "broken test is executing" )  
    if  oranges == apple:  
        results =  False  
        print ( f"this is the where it's happening:  {sys._getframe().f_lineno} " )  
    elif oranges != apple:  
        results =  False   
        print ( "afterElseif" )  
    return  results 
 
 
 
def complicated_function( arg ): 
 
 #not here yet  
 
    print ( "finding id..." ) 
 
 
 
 
 
 print ( "testing a false method in the test_bool(arg):" ) 
 
 print (test_bool(test_method( 10 ))) 
 
 print ( "testing a true method in the test_bool(arg):" ) 
 
 print (test_bool(test_method( 800 ))) 
 
 
 
 print ( "testing broken method in the test_bool(arg):" ) 
 
 print (test_bool_broken(broken_test_method( 10 ))) 
 
 print ( "testing broken method in the test_bool(arg):" ) 
 
print (test_bool_broken(broken_test_method( 'oranges' ))) I don't know why I can't get rid of the formatting imprinted by my VScode editor
copy and paste. Below is the powershell run, that worked, it failed, but that's good
it worked.

Now the two files I used for this....

and the test--->

Comments

Popular posts from this blog

playing with color in powershell python

JavaScript Ascii animation with while loops and console.log

playing with trigonometry sin in pygame