comparison tests/test_page.py @ 979:45ad976712ec

tests: Big push to get the tests to pass again. - Lots of fixes everywhere in the code. - Try to handle debug logging in the multiprocessing worker pool when running in pytest. Not perfect, but usable for now. - Replace all `.md` test files with `.html` since now a auto-format extension always sets the format. - Replace `out` with `outfiles` in most places since now blog archives are added to the bake output and I don't want to add expected outputs for blog archives everywhere.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 29 Oct 2017 22:51:57 -0700
parents 72f17534d58e
children
comparison
equal deleted inserted replaced
978:7e51d14097cb 979:45ad976712ec
4 4
5 test_parse_segments_data1 = ("", {'content': ''}) 5 test_parse_segments_data1 = ("", {'content': ''})
6 test_parse_segments_data2 = ("Foo bar", {'content': 'Foo bar'}) 6 test_parse_segments_data2 = ("Foo bar", {'content': 'Foo bar'})
7 test_parse_segments_data3 = ( 7 test_parse_segments_data3 = (
8 """Something that spans 8 """Something that spans
9 several lines 9 several lines
10 like this""", 10 like this""",
11 {'content': """Something that spans 11 {'content': """Something that spans
12 several lines 12 several lines
13 like this"""}) 13 like this"""})
14 test_parse_segments_data4 = ( 14 test_parse_segments_data4 = (
15 """Blah blah 15 """Blah blah
16 ---foo--- 16 ---foo---
17 Something else 17 Something else
18 ---bar--- 18 ---bar---
19 Last thing 19 Last thing
20 """, 20 """,
21 { 21 {
22 'content': "Blah blah\n", 22 'content': "Blah blah\n",
23 'foo': "Something else\n", 23 'foo': "Something else\n",
24 'bar': "Last thing\n"}) 24 'bar': "Last thing\n"})
25 25
44 ('\n', 2), 44 ('\n', 2),
45 ('blah foo', 1), 45 ('blah foo', 1),
46 ('blah foo\n', 2), 46 ('blah foo\n', 2),
47 ('blah foo\nmore here', 2), 47 ('blah foo\nmore here', 2),
48 ('blah foo\nmore here\n', 3), 48 ('blah foo\nmore here\n', 3),
49 ('\nblah foo\nmore here\n', 3), 49 ('\nblah foo\nmore here\n', 4),
50 ]) 50 ])
51 def test_count_lines(text, expected): 51 def test_count_lines(text, expected):
52 actual = _count_lines(text) 52 actual = _count_lines(text)
53 assert actual == expected 53 assert actual == expected
54 54
61 ('blah foo\nmore here', 4, -1, 2), 61 ('blah foo\nmore here', 4, -1, 2),
62 ('blah foo\nmore here\n', 10, -1, 2), 62 ('blah foo\nmore here\n', 10, -1, 2),
63 ('\nblah foo\nmore here\n', 2, -1, 3), 63 ('\nblah foo\nmore here\n', 2, -1, 3),
64 ]) 64 ])
65 def test_count_lines_with_offsets(text, start, end, expected): 65 def test_count_lines_with_offsets(text, start, end, expected):
66 actual = _count_lines(text) 66 actual = _count_lines(text, start, end)
67 assert actual == expected 67 assert actual == expected