comparison tests/test_fetch_command.py @ 7:79b0e059319d

Reorganized the testing infrastructure a bit so that svnwrap is really separate from the rest of the project. Also made it easier to add more tests in the future without making the directory full of annoying files.
author Augie Fackler <durin42@gmail.com>
date Fri, 03 Oct 2008 09:41:25 -0500
parents test_fetch_command.py@f2636cfed115
children
comparison
equal deleted inserted replaced
6:1a5bb173170b 7:79b0e059319d
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']