source: tailor/vcpx/tests/cvsps.py @ 380

Revision 380, 2.2 KB checked in by lele@…, 8 years ago (diff)

Do not suggest every source is a script by itself

Line 
1# -*- mode: python; coding: utf-8 -*-
2# :Progetto: vcpx -- basic cvsps tests
3# :Creato:   ven 09 lug 2004 01:43:52 CEST
4# :Autore:   Lele Gaifax <lele@nautilus.homeip.net>
5# :Licenza:  GNU General Public License
6#
7
8from unittest import TestCase, TestSuite
9from datetime import datetime
10from StringIO import StringIO
11from vcpx.cvsps import changesets_from_cvsps
12
13class CvspsParserTest(TestCase):
14    """Ensure the cvsps parser does its job."""
15
16    SIMPLE_TEST = """\
17---------------------
18PatchSet 1500
19Date: 2004/05/09 17:54:22
20Author: grubert
21Branch: HEAD
22Tag: (none)
23Log:
24Tell the reason for using mbox (not wrapping long lines).
25
26Members:
27\tdocutils/writers/latex2e.py:1.78->1.79
28
29"""
30
31    DOUBLE_TEST = """\
32---------------------
33PatchSet 819
34Date: 2004/06/26 12:05:44
35Author: ajung
36Branch: HEAD
37Tag: (none)
38Log:
39cleanup
40
41Members:
42\tNormalizer.py:1.12->1.13
43\tRegistry.py:1.22->1.23
44\tRegistry.py:1.21->1.22
45\tStopwords.py:1.9->1.10
46
47"""
48
49    def testBasicBehaviour(self):
50        """Verify basic cvsps log parser behaviour"""
51
52        log = StringIO(self.SIMPLE_TEST)
53        csets = changesets_from_cvsps(log)
54
55        cset = csets.next()
56        self.assertEqual(cset.revision, '1500')
57        self.assertEqual(cset.author, "grubert")
58        self.assertEqual(cset.date, datetime(2004, 5, 9, 17, 54, 22))
59        self.assertEqual(cset.log, "Tell the reason for using mbox "
60                                   "(not wrapping long lines).")
61       
62    def testDoubleEntry(self):
63        """Verify the cvsps log parser recognizes double entries"""
64
65        log = StringIO(self.DOUBLE_TEST)
66        csets = changesets_from_cvsps(log)
67
68        cset = csets.next()
69        self.assertEqual(len(cset.entries), 3)
70
71        e = cset.entries[0]
72        self.assertEqual(e.name, "Normalizer.py")
73        self.assertEqual(e.old_revision, '1.12')
74        self.assertEqual(e.new_revision, '1.13')
75
76        e = cset.entries[1]
77        self.assertEqual(e.name, "Registry.py")
78        self.assertEqual(e.old_revision, '1.21')
79        self.assertEqual(e.new_revision, '1.23')
80
81        e = cset.entries[2]
82        self.assertEqual(e.name, "Stopwords.py")
83        self.assertEqual(e.old_revision, '1.9')
84        self.assertEqual(e.new_revision, '1.10')
Note: See TracBrowser for help on using the repository browser.