summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormasklinn <bitbucket.org@masklinn.net>2014-03-11 10:16:30 +0100
committermasklinn <bitbucket.org@masklinn.net>2014-03-11 10:16:30 +0100
commit6b37f5f1de6fb813056fc994cd7fa776996b659e (patch)
treea9eb837a501f8f5971ce37e9504787ce35624b3e
parent897b707bc1208793b7f63dd28d9167b2ce7ab766 (diff)
downloadpython-fastimport-git-6b37f5f1de6fb813056fc994cd7fa776996b659e.tar.gz
Test copy-with-replacement and invalid copy
Styllistic fixes, ensure compatibility with pre-2.7 unittest
-rw-r--r--fastimport/tests/test_commands.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/fastimport/tests/test_commands.py b/fastimport/tests/test_commands.py
index 12a3772..a8f39d4 100644
--- a/fastimport/tests/test_commands.py
+++ b/fastimport/tests/test_commands.py
@@ -198,24 +198,35 @@ class TestCommitDisplay(TestCase):
repr(c))
class TestCommitCopy(TestCase):
+
def setUp(self):
super(TestCommitCopy, self).setUp()
file_cmds = iter([
commands.FileDeleteCommand('readme.txt'),
commands.FileModifyCommand('NEWS', 0100644, None, 'blah blah blah'),
])
- # user tuple is (name, email, secs-since-epoch, secs-offset-from-utc)
+
committer = ('Joe Wong', 'joe@example.com', 1234567890, -6 * 3600)
self.c = commands.CommitCommand(
"refs/heads/master", "bbb", None, committer,
"release v1.0", ":aaa", None, file_cmds)
- def test_noop(self):
+ def test_simple_copy(self):
c2 = self.c.copy()
- self.assertIsNot(self.c, c2)
+ self.assertFalse(self.c is c2)
self.assertEqual(repr(self.c), repr(c2))
+ def test_replace_attr(self):
+ c2 = self.c.copy(mark='ccc')
+
+ self.assertEqual(
+ repr(self.c).replace('mark :bbb', 'mark :ccc'),
+ repr(c2))
+
+ def test_invalid_attribute(self):
+ self.assertRaises(TypeError, self.c.copy, invalid=True)
+
class TestFeatureDisplay(TestCase):
def test_feature(self):