I’m on the fence if this is useless …
I want to figure out how to make a method that test’s another methods boolean results, and returns where that result was made… Like where the method being tested evaluated to the return value.
I had a problem in a different program in JAVA and if I had a way to find out which if statement in it was mucking me up that would have been great, and saved me a lot of time.
Here’s what I got so far.
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 = bool(0 == 0)
print(f"testing {a} : ")
print(test_bool(a))
b = bool(3 > 4)
print(f"testing {b} : ")
print(test_bool(b))
c = bool('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("afterif")
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')))