I'm testing a Python script who throws a bunch of bytes (as a string) as the result of his execution.
Firstly, I get the result with:
myOutput = subprocess.check_output(["python","../src/myScript.py"])
With this, I execute the script and get the output.
Then I compare this result with a really long expected output:
expOutput = "382d006e756c6c2c7465737453657450726f706572747953823c75652c6c75614170702c63617074696f6e2c486f6c61206d756e646f203200"
self.assertEqual(myOutput, expOutput, "Script output is not the expected")
(It's just a silly test, I'm trying the get things to work).
Problem: My test FAILS. Debugging I founded the values are equal.
Can anyone help me?
Thanks!
Could be a stray eol at the end of the output from the called script. Try this:
myOutput = myOutput.strip()
self.assertEqual(myOutput, expOutput, "Script output is not the expected")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.