While working in Meltdown Mitigation (Python route) I was performing some troubleshooting by outputting function argument variables with print() statements.
After numerous runs it became apparent that the ‘Your Output’ section of the test runs did not properly coincide with the tests being run.
After working with Discord users, I was asked to present this as a possible bug in the test runner.
Code Run
temp = 10
threshold = 10000
test_data = ((399, 'LOW'), (300, 'LOW'), (1, 'LOW'),
(0, 'LOW'), (901, 'NORMAL'), (1000, 'NORMAL'),
(1099, 'NORMAL'), (899, 'LOW'), (700, 'LOW'),
(400, 'LOW'), (1101, 'DANGER'), (1200, 'DANGER'))
for variant, (neutrons_per_second, expected) in enumerate(test_data, start=1):
with self.subTest(f'variation #{variant}', temp=temp, neutrons_per_second=neutrons_per_second,
threshold=threshold, expected=expected):
# pylint: disable=assignment-from-no-return
actual_result = fail_safe(temp, neutrons_per_second, threshold)
failure_message = (f'Called fail_safe({temp}, {neutrons_per_second}, {threshold}). '
f'The function returned {actual_result}, '
f'but the test expected {expected} as the return value.')
self.assertEqual(actual_result, expected, failure_message)
Test Failure
AssertionError: 'DANGER' != 'NORMAL'
- DANGER
+ NORMAL
: Called fail_safe(10, 901, 10000). The function returned DANGER, but the test expected NORMAL as the return value.
Your Output
1099
There was also an instance where the output was looping, but there is no loop code in my solution.
