summaryrefslogtreecommitdiff
path: root/fastimport/tests
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-02-28 12:49:37 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-02-28 12:49:37 +0100
commit3238618f956afa5d2f23ee607536c4383f5b1cd8 (patch)
tree758dac89b0688c38da1dcf16ed07c537af94e796 /fastimport/tests
parent0d0a934996871e5245564ba06d4fc3b9b2f5964c (diff)
downloadpython-fastimport-3238618f956afa5d2f23ee607536c4383f5b1cd8.tar.gz
Implement 'done' feature.
Diffstat (limited to 'fastimport/tests')
-rw-r--r--fastimport/tests/test_parser.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/fastimport/tests/test_parser.py b/fastimport/tests/test_parser.py
index 06270a8..4bf11c7 100644
--- a/fastimport/tests/test_parser.py
+++ b/fastimport/tests/test_parser.py
@@ -259,6 +259,32 @@ class TestImportParser(testtools.TestCase):
self.assertEqual('Donald', cmd.more_authors[1][0])
self.assertEqual('donald@duck.org', cmd.more_authors[1][1])
+ def test_done_feature_missing_done(self):
+ s = StringIO.StringIO("""feature done
+""")
+ p = parser.ImportParser(s)
+ cmds = p.iter_commands()
+ self.assertEquals("feature", cmds.next().name)
+ self.assertRaises(errors.PrematureEndOfStream, cmds.next)
+
+ def test_done_with_feature(self):
+ s = StringIO.StringIO("""feature done
+done
+more data
+""")
+ p = parser.ImportParser(s)
+ cmds = p.iter_commands()
+ self.assertEquals("feature", cmds.next().name)
+ self.assertRaises(StopIteration, cmds.next)
+
+ def test_done_without_feature(self):
+ s = StringIO.StringIO("""done
+more data
+""")
+ p = parser.ImportParser(s)
+ cmds = p.iter_commands()
+ self.assertEquals([], list(cmds))
+
class TestStringParsing(testtools.TestCase):