Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from e24_reverse_lines import reverse_lines 

2import pytest 

3 

4 

5@pytest.fixture 

6def big_file(tmp_path): 

7 f = tmp_path / 'bigfile.txt' 

8 f.write_text('''This is the first line of a big file 

9 

10and this is the second line 

11and this is, to no one's surprise, the third line 

12but the biggest word will probably be encyclopedia''') 

13 return f 

14 

15 

16def test_reversing_lines(big_file): 

17 reverse_lines(big_file, 'output.txt') 

18 content = open('output.txt').read() 

19 assert len(content) == 167 

20 assert content[:18] == 'elif gib a fo enil' 

21 assert content[-18:] == 'w tseggib eht tub\n'