comparison tests/test_fetch_command_regexes.py @ 13:e60bd31f58a7

Rename this file so I can have a file that tests the other bits of fetch.
author Augie Fackler <durin42@gmail.com>
date Tue, 07 Oct 2008 17:46:43 -0500
parents tests/test_fetch_command.py@79b0e059319d
children 48a44546c12f
comparison
equal deleted inserted replaced
12:c5039390332f 13:e60bd31f58a7
1 import fetch_command
2
3 two_empties = """Index: __init__.py
4 ===================================================================
5 Index: bar/__init__.py
6 ===================================================================
7 Index: bar/test_muhaha.py
8 ===================================================================
9 --- bar/test_muhaha.py (revision 0)
10 +++ bar/test_muhaha.py (revision 1)
11 @@ -0,0 +1,2 @@
12 +
13 +blah blah blah, I'm a fake patch
14 \ No newline at end of file
15 """
16
17 def test_empty_file_re():
18 matches = fetch_command.empty_file_patch_wont_make_re.findall(two_empties)
19 assert sorted(matches) == ['__init__.py', 'bar/__init__.py']
20
21 def test_any_matches_just_one():
22 pat = '''Index: trunk/django/contrib/admin/urls/__init__.py
23 ===================================================================
24 '''
25 matches = fetch_command.any_file_re.findall(pat)
26 assert len(matches) == 1
27
28 def test_any_file_re():
29 matches = fetch_command.any_file_re.findall(two_empties)
30 assert sorted(matches) == ['__init__.py', 'bar/__init__.py',
31 'bar/test_muhaha.py']
32 binary_delta = """Index: trunk/functional_tests/doc_tests/test_doctest_fixtures/doctest_fixtures_fixtures.pyc
33 ===================================================================
34 Cannot display: file marked as a binary type.
35 svn:mime-type = application/octet-stream
36
37 Property changes on: trunk/functional_tests/doc_tests/test_doctest_fixtures/doctest_fixtures_fixtures.pyc
38 ___________________________________________________________________
39 Added: svn:mime-type
40 + application/octet-stream
41
42 Index: trunk/functional_tests/doc_tests/test_doctest_fixtures/doctest_fixtures.rst
43 ===================================================================
44 """
45 def test_binary_file_re():
46 matches = fetch_command.binary_file_re.findall(binary_delta)
47 print matches
48 assert matches == ['trunk/functional_tests/doc_tests/test_doctest_fixtures/doctest_fixtures_fixtures.pyc']