~certify-web-dev/twisted/certify-trunk

« back to all changes in this revision

Viewing changes to twisted/test/test_versions.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-17 14:52:35 UTC
  • mfrom: (1.1.5 upstream) (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20070117145235-btmig6qfmqfen0om
Tags: 2.5.0-0ubuntu1
New upstream version, compatible with python2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (c) 2006 Twisted Matrix Laboratories.
2
2
# See LICENSE for details.
3
3
 
 
4
from cStringIO import StringIO
 
5
 
4
6
from twisted.python.versions import Version, IncomparableVersions
5
7
 
6
8
from twisted.trial import unittest
41
43
    def testShort(self):
42
44
        self.assertEquals(Version('dummy', 1, 2, 3).short(),
43
45
                          '1.2.3')
 
46
 
 
47
 
 
48
    def test_goodSVNEntries(self):
 
49
        """
 
50
        Version should be able to parse an SVN entries file.
 
51
        """
 
52
        version = Version("dummy", 1, 0, 0)
 
53
        crap = '''<?xml version="1.0" encoding="utf-8"?>
 
54
<wc-entries
 
55
   xmlns="svn:">
 
56
<entry
 
57
   committed-rev="18210"
 
58
   name=""
 
59
   committed-date="2006-09-21T04:43:09.542953Z"
 
60
   url="svn+ssh://svn.twistedmatrix.com/svn/Twisted/trunk/twisted"
 
61
   last-author="exarkun"
 
62
   kind="dir"
 
63
   uuid="bbbe8e31-12d6-0310-92fd-ac37d47ddeeb"
 
64
   repos="svn+ssh://svn.twistedmatrix.com/svn/Twisted"
 
65
   revision="18211"/>
 
66
</wc-entries>
 
67
'''
 
68
        self.assertEquals(version._parseSVNEntries(StringIO(crap)), '18211')
 
69
 
 
70
 
 
71
    def test_parseBrokenSVNEntries(self):
 
72
        """
 
73
        If there is a broken SVN entries file, it should return an SVN
 
74
        revision of "Unknown".
 
75
        """
 
76
        version = Version("dummy", 1, 0, 0)
 
77
        self.assertEquals(version._parseSVNEntries(StringIO('I like puppies')), 
 
78
                          "Unknown")