Whole file
alessandromaggio/pythonping
The author described this change as “Fix Packet loss calculation and add new test”. It counts as a record because the check below fails on the code as it stood at 482144c29 and passes on 39594cc1e, with nothing else changed between the two runs.
Projectalessandromaggio/pythonping
Fix saved2021-04-19
Sharing licenceMIT · LICENSE
Change size+1 −1
What the code was meant to do, written into the code itself as a save note
Fix Packet loss calculation and add new test
The change
| 203 | 203 | if value.time_elapsed < self.rtt_min: | |
| 204 | 204 | self.rtt_min = value.time_elapsed | |
| 205 | 205 | ||
| 206 | - | self.packets_lost = self.packets_lost + (0 if value.success else 1 - self.packets_lost) / len(self) | |
| 206 | + | self.packets_lost = self.packets_lost + ((0 if value.success else 1) - self.packets_lost) / len(self) | |
| 207 | 207 | ||
| 208 | 208 | if self.verbose: | |
| 209 | 209 | print(value, file=self.output) |
The check that tells the two apart
fail→pass·test/test_executor.py::ResponseListTestCase::test_some_packets_lost_mixed
Check file test/test_executor.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it482144c29f472c137897257bde645255931f9a66
Broken version dated2021-03-12
Modulepythonping.executor
Units changedResponseList
Fingerprintad71ea6050e1b8a1
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.