- include help
- Morning Lecture Video
- Bishal Khanal
- Dwight Lindquist
- Roger Wells
- regex101
- Day after lecture
- Created test and ran
pytest
- Imported formula from series module to test_series module
- Run
pytest
- Fleshed out formula in series module
- Run
pytest
- If failed, tweak check for error and refactor accordingly
- GOOGLE, PEER, TA
- If Pass, proceed to next formula.
- If failed, tweak check for error and refactor accordingly
- Define functions to 'skip test'
- Find first error, which is a typeError: read_template() takes 0 position arguments but 1 was given
- Now, AssertionError: assert None == 'It was {Adjective} and {Adjective} {Noun}.'
- Look at test and see what it is looking for.
- return that to pass.
- provide .txt file # for first test
- read()
- there is still white space, use strip to git rid.
- Repeat steps 1 -5 for next test
- return tuple, but there was an error of an extra parenthesis, so delete outer parenthesis
- iterate through the string
for char in template:
if not capturing:
stripped += char
if char == "{":
capturing = True
else:
if char == "}":
stripped += char
# more to do
else:
capture += char
parts.append(capture)
capture = ""
capturing = False
else:
capture += char
when in the mode of iterating, create capturing var and assign it to false.
capture = ""
some_tuple = ("a",1, True) # as soon as you use that comma, it becomes a tuple.
def parse_template required to use regex. Regex made it INSANELY harder. I needed a lot of hand holding on this on.
def test_read_template_raises_exception_with_bad_path threw me for a quick loop.