Mercurial > hgsubversion
comparison tests/test_fetch_command_regexes.py @ 304:ce676eff002b
First merge, totally untested.
| author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
|---|---|
| date | Fri, 01 May 2009 10:28:59 +0200 |
| parents | e2214c8fc91f |
| children | 46e69be8e2c8 |
comparison
equal
deleted
inserted
replaced
| 303:f423a8780832 | 304:ce676eff002b |
|---|---|
| 1 import fetch_command | 1 import stupid |
| 2 import unittest | 2 import unittest |
| 3 | 3 |
| 4 two_empties = """Index: __init__.py | 4 two_empties = """Index: __init__.py |
| 5 =================================================================== | 5 =================================================================== |
| 6 Index: bar/__init__.py | 6 Index: bar/__init__.py |
| 44 | 44 |
| 45 """ | 45 """ |
| 46 | 46 |
| 47 class RegexTests(unittest.TestCase): | 47 class RegexTests(unittest.TestCase): |
| 48 def test_empty_file_re(self): | 48 def test_empty_file_re(self): |
| 49 matches = fetch_command.empty_file_patch_wont_make_re.findall(two_empties) | 49 matches = stupid.empty_file_patch_wont_make_re.findall(two_empties) |
| 50 assert sorted(matches) == ['__init__.py', 'bar/__init__.py'] | 50 assert sorted(matches) == ['__init__.py', 'bar/__init__.py'] |
| 51 | 51 |
| 52 def test_any_matches_just_one(self): | 52 def test_any_matches_just_one(self): |
| 53 pat = '''Index: trunk/django/contrib/admin/urls/__init__.py | 53 pat = '''Index: trunk/django/contrib/admin/urls/__init__.py |
| 54 =================================================================== | 54 =================================================================== |
| 55 ''' | 55 ''' |
| 56 matches = fetch_command.any_file_re.findall(pat) | 56 matches = stupid.any_file_re.findall(pat) |
| 57 assert len(matches) == 1 | 57 assert len(matches) == 1 |
| 58 | 58 |
| 59 def test_special_re(self): | 59 def test_special_re(self): |
| 60 matches = fetch_command.property_special_set_re.findall(special_delta) | 60 matches = stupid.property_special_set_re.findall(special_delta) |
| 61 assert len(matches) == 1 | 61 assert len(matches) == 1 |
| 62 | 62 |
| 63 def test_any_file_re(self): | 63 def test_any_file_re(self): |
| 64 matches = fetch_command.any_file_re.findall(two_empties) | 64 matches = stupid.any_file_re.findall(two_empties) |
| 65 assert sorted(matches) == ['__init__.py', 'bar/__init__.py', | 65 assert sorted(matches) == ['__init__.py', 'bar/__init__.py', |
| 66 'bar/test_muhaha.py'] | 66 'bar/test_muhaha.py'] |
| 67 | 67 |
| 68 def test_binary_file_re(self): | 68 def test_binary_file_re(self): |
| 69 matches = fetch_command.binary_file_re.findall(binary_delta) | 69 matches = stupid.binary_file_re.findall(binary_delta) |
| 70 assert matches == ['trunk/functional_tests/doc_tests/test_doctest_fixtures/doctest_fixtures_fixtures.pyc'] | 70 assert matches == ['trunk/functional_tests/doc_tests/test_doctest_fixtures/doctest_fixtures_fixtures.pyc'] |
| 71 | 71 |
| 72 def suite(): | 72 def suite(): |
| 73 return unittest.TestLoader().loadTestsFromTestCase(RegexTests) | 73 return unittest.TestLoader().loadTestsFromTestCase(RegexTests) |
