I am re-doing the https://adventofcode.com/2020/day/7 by splitting the input into useful information. When I run the following scripts:
script.py
def parse_line(input):
d = dict(x.split(" bags contain ") for x in input.split("\n"))
return(d)
test_script.py
import unittest
import script
class Test(unittest.TestCase):
def test_parse(self):
data = """vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.
faded blue bags contain no other bags.
dotted black bags contain no other bags."""
self.assertEqual(0, script.parse(data))
if __name__ == '__main__':
unittest.main()
The output in the terminal shows: AssertionError: 0 != {'vibrant plum': '5 faded blue bags, 6 do[79 chars]gs.'}
Why is this [79 chars] resulted instead of the whole phrase? I tried to look up in internet without success. What does this mean and what can be done?