Skip to content

Commit 6582874

Browse files
committed
Python 3. Clean up tests.
1 parent e7e1fb4 commit 6582874

File tree

9 files changed

+164
-214
lines changed

9 files changed

+164
-214
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
all:
22
nosetests
33

4+
clean:
5+
find whatthepatch tests -name '*.pyc' -exec rm {} \;
6+
7+
test:
8+
. env2/bin/activate && nosetests || true
9+
. env3/bin/activate && nosetests || true
10+
411
init: init2 init3
512

613
init2:

tests/context.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/test_apply.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# -*- coding: utf-8 -*-
2-
# test_basic.py
32

4-
from context import whatthepatch
3+
import whatthepatch as wtp
54

6-
from whatthepatch import apply
75

86
import unittest
97
from io import StringIO
@@ -28,30 +26,30 @@ def test_diff_default(self):
2826
with open('tests/casefiles/diff-default.diff') as f:
2927
diff_text = f.read()
3028

31-
diff = [x for x in whatthepatch.parse_patch(diff_text)]
29+
diff = [x for x in wtp.parse_patch(diff_text)]
3230
diff = diff[0]
3331

34-
new_text = apply.apply_diff(diff, self.lao)
32+
new_text = wtp.apply.apply_diff(diff, self.lao)
3533
self.assertEquals(new_text, self.tzu)
3634

3735
def test_diff_context(self):
3836
with open('tests/casefiles/diff-context.diff') as f:
3937
diff_text = f.read()
4038

41-
diff = [x for x in whatthepatch.parse_patch(diff_text)]
39+
diff = [x for x in wtp.parse_patch(diff_text)]
4240
diff = diff[0]
4341

44-
new_text = apply.apply_diff(diff, self.lao)
42+
new_text = wtp.apply.apply_diff(diff, self.lao)
4543
self.assertEquals(new_text, self.tzu)
4644

4745
def test_diff_unified(self):
4846
with open('tests/casefiles/diff-unified.diff') as f:
4947
diff_text = f.read()
5048

51-
diff = [x for x in whatthepatch.parse_patch(diff_text)]
49+
diff = [x for x in wtp.parse_patch(diff_text)]
5250
diff = diff[0]
5351

54-
new_text = apply.apply_diff(diff, self.lao)
52+
new_text = wtp.apply.apply_diff(diff, self.lao)
5553
for e in self.tzu:
5654
print(e)
5755
print('~~~~')
@@ -64,22 +62,22 @@ def test_diff_unified_patchutil(self):
6462
with open('tests/casefiles/diff-unified.diff') as f:
6563
diff_text = f.read()
6664

67-
diff = [x for x in whatthepatch.parse_patch(diff_text)]
65+
diff = [x for x in wtp.parse_patch(diff_text)]
6866
diff = diff[0]
6967

70-
new_text = apply.apply_diff(diff, self.lao, use_patch=True)
68+
new_text = wtp.apply.apply_diff(diff, self.lao, use_patch=True)
7169
self.assertEquals(new_text, (self.tzu, None))
7270

73-
self.assertRaises(AssertionError, apply.apply_diff, diff, [''] + self.lao, use_patch=True)
71+
self.assertRaises(AssertionError, wtp.apply.apply_diff, diff, [''] + self.lao, use_patch=True)
7472

7573
def test_diff_rcs(self):
7674
with open('tests/casefiles/diff-rcs.diff') as f:
7775
diff_text = f.read()
7876

79-
diff = [x for x in whatthepatch.parse_patch(diff_text)]
77+
diff = [x for x in wtp.parse_patch(diff_text)]
8078
diff = diff[0]
8179

82-
new_text = apply.apply_diff(diff, self.lao)
80+
new_text = wtp.apply.apply_diff(diff, self.lao)
8381
self.assertEquals(new_text, self.tzu)
8482

8583
def test_diff_ed(self):
@@ -89,14 +87,14 @@ def test_diff_ed(self):
8987
print(diff_text)
9088
print(diff_text.splitlines())
9189

92-
diff = [x for x in whatthepatch.parse_patch(diff_text)]
90+
diff = [x for x in wtp.parse_patch(diff_text)]
9391
diff = diff[0]
9492

9593
print(diff)
96-
new_text = apply.apply_diff(diff, self.lao)
94+
new_text = wtp.apply.apply_diff(diff, self.lao)
9795
self.assertEquals(self.tzu,new_text)
9896

99-
new_text = apply.apply_diff(diff, self.lao, use_patch=True)
97+
new_text = wtp.apply.apply_diff(diff, self.lao, use_patch=True)
10098
self.assertEquals(new_text, (self.tzu, None))
10199

102100
if __name__ == '__main__':

tests/test_basic.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)