The ExceptionReporter supports Unix, Windows and Macintosh EOL markers
(self)
| 634 | ) |
| 635 | |
| 636 | def test_eol_support(self): |
| 637 | """ |
| 638 | The ExceptionReporter supports Unix, Windows and Macintosh EOL markers |
| 639 | """ |
| 640 | LINES = ["print %d" % i for i in range(1, 6)] |
| 641 | reporter = ExceptionReporter(None, None, None, None) |
| 642 | |
| 643 | for newline in ["\n", "\r\n", "\r"]: |
| 644 | fd, filename = tempfile.mkstemp(text=False) |
| 645 | os.write(fd, (newline.join(LINES) + newline).encode()) |
| 646 | os.close(fd) |
| 647 | |
| 648 | try: |
| 649 | self.assertEqual( |
| 650 | reporter._get_lines_from_file(filename, 3, 2), |
| 651 | (1, LINES[1:3], LINES[3], LINES[4:]), |
| 652 | ) |
| 653 | finally: |
| 654 | os.unlink(filename) |
| 655 | |
| 656 | def test_no_exception(self): |
| 657 | "An exception report can be generated for just a request" |
nothing calls this directly
no test coverage detected