A theory lets us make predictions on the reality.
A theory is a framework that explains and predicts observations
Using
we can obtain a 'theory' (or 'diagnosis') of what the error is.
Input | Expected | Output |
---|---|---|
<b>foo</b> | foo | foo |
"<b>foo</b>" | "foo" | <b>foo</b> |
Input | Expected | Output |
---|---|---|
<b>foo</b> | foo | foo |
"<b>foo</b>" | "foo" | <b>foo</b> |
These may be two separate issues, but are more likely to be linked.
If this is correct then, "foo" would become foo. Let's test that:
#!/usr/bin/python3 def removeHtmlMarkup(s): tag = False quote = False out = "" for c in s: if c == '<' and not quote: # Start of markup tag = True elif c == '>' and not quote: # End of markup tag = False elif c == '"' or c == "'" and tag: # Quote quote = not quote elif not tag: out = out + c return out """ Our hypotheses """ if __name__ == "__main__": print (removeHtmlMarkup('"foo"'), '\tExpect "foo"\tHypothesis: foo') # Test the hypothesis about bar # print (removeHtmlMarkup('"bar"'), '\tExpect "bar"\tHypothesis: [BLANK]') # Test if it matters whether there is anything else present # print (removeHtmlMarkup('""'), '\tExpect ""\tHypothesis: [BLANK]')
We now know that we can refine the hypothesis:
elif c == '"' or c == "'" and tag: # Quote quote = not quote
We make a new hypothesis about the error