| 440 | ], |
| 441 | ) |
| 442 | def test_load_patterns_from_file(tmpdir, lines, expected_roots, expected_numpatterns): |
| 443 | def evaluate(filename): |
| 444 | roots = [] |
| 445 | inclexclpatterns = [] |
| 446 | with open(filename) as f: |
| 447 | load_pattern_file(f, roots, inclexclpatterns) |
| 448 | return roots, len(inclexclpatterns) |
| 449 | |
| 450 | patternfile = tmpdir.join("patterns.txt") |
| 451 | |
| 452 | with patternfile.open("wt") as fh: |
| 453 | fh.write("\n".join(lines)) |
| 454 | |
| 455 | roots, numpatterns = evaluate(str(patternfile)) |
| 456 | assert roots == expected_roots |
| 457 | assert numpatterns == expected_numpatterns |
| 458 | |
| 459 | |
| 460 | def test_switch_patterns_style(): |