Ejemplo n.º 1
0
 def testMultipleLangs(self):
     save_locale = PyICU.Locale.getDefault()
     
     PyICU.Locale.setDefault(PyICU.Locale.createFromName('fr_FR'))
     
     try:
         result = list(updates.iterVersions(
 """<a><b class="release-info">
 <c class="release-version">1.0.blurdy</c>
 <x href="http://www.example.com/" class="announcement-url" />
 <woot href="http://www.example.com/download.zip" class="download-the-bestest">Woot!</woot>
 <aha class="release-new-features">Now with vim &amp; verve</aha>
 <x class="release-new-features" lang="fr">Bonjour, mesdames et messieurs</x>
 </b></a>"""
         ))
         self.failUnlessEqual(
             result, [
                 ("1.0.blurdy",
                 { "the-bestest": "http://www.example.com/download.zip"},
                 "http://www.example.com/",
                 "Bonjour, mesdames et messieurs")
             ]
         )
     finally:
         if save_locale is not None:
             PyICU.Locale.setDefault(save_locale)
Ejemplo n.º 2
0
    def testCurrent(self):
        result = list(updates.iterVersions(
"""<div class="release-info" id="chandler-0.7.5.1">
<h1>Download Chandler Desktop <span class="release-version">0.7.5.1</span></h1>
<p />
<h2><a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_win_0.7.5.1.exe" target="_top" class="download-windows">Windows</a> |
<a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/#enduserlinux" target="_top">Linux</a> |
Mac OS X:
<a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_ppc-osx_0.7.5.1.dmg" target="_top" class="download-osx-ppc">PPC</a> |
<a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_intel-osx_0.7.5.1.dmg" target="_top" class="download-osx-intel">Intel</a> | <a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_intel-osx-leopard_0.7.5.1.dmg" target="_top" class="download-osx-intel-10.5">Leopard</a> </h2>
<a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_linux_0.7.5.1-1_i386.deb" class="download-linux" style="display:none"></a>
<p />
<div style="display:none">
<div class="release-new-features" lang="en">Drag-and-droppable sidebar collections</div>
</div>
<h3><a href="http://blog.chandlerproject.org/2008/03/26/chandler-0751/" class="announcement-url">Release announcement and notes for 0.7.5.1</a> </h3>
</div>
"""))
        self.failUnlessEqual(len(result), 1)
        
        t = result[0]
        self.failUnlessEqual(t[0], '0.7.5.1')
        self.failUnlessEqual(t[2], 'http://blog.chandlerproject.org/2008/03/26/chandler-0751/')
        self.failUnlessEqual(t[1], {
                'linux': 'http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_linux_0.7.5.1-1_i386.deb',
                'osx-ppc': 'http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_ppc-osx_0.7.5.1.dmg',
                'osx-intel-10.5': 'http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_intel-osx-leopard_0.7.5.1.dmg',
                'osx-intel': 'http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_intel-osx_0.7.5.1.dmg',
                'windows': 'http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_win_0.7.5.1.exe',
            }
        )
        self.failUnlessEqual(t[3], "Drag-and-droppable sidebar collections")
Ejemplo n.º 3
0
    def testNoReleaseVersion(self):
        result = list(updates.iterVersions(
"""<a><b class="release-info">
<x href="http://www.example.com/" class="announcement-url" />
</b></a>"""
        ))
        self.failUnlessEqual(result, [])
    def testReleaseVersionOnly(self):
        result = list(
            updates.iterVersions("""<a><b class="release-info">
<c class="release-version">1.0.blurdy</c>
<x href="http://www.example.com/" class="announcement-url" />
</b></a>"""))
        self.failUnlessEqual(
            result, [("1.0.blurdy", {}, "http://www.example.com/", None)])
Ejemplo n.º 5
0
    def testReleaseVersionOnly(self):
        result = list(updates.iterVersions(
"""<a><b class="release-info">
<c class="release-version">1.0.blurdy</c>
<x href="http://www.example.com/" class="announcement-url" />
</b></a>"""
        ))
        self.failUnlessEqual(
            result,
            [("1.0.blurdy", {}, "http://www.example.com/", None)]
        )
    def testSingleReleaseNoFeatureAnnounce(self):
        result = list(
            updates.iterVersions("""<a><b class="release-info">
<c class="release-version">1.0.blurdy</c>
<x href="http://www.example.com/" class="announcement-url" />
<woot href="http://www.example.com/download.zip" class="download-the-bestest">Woot!</woot>
</b></a>"""))
        self.failUnlessEqual(
            result, [("1.0.blurdy", {
                "the-bestest": "http://www.example.com/download.zip"
            }, "http://www.example.com/", None)])
Ejemplo n.º 7
0
    def testSingleReleaseNoFeatureAnnounce(self):
        result = list(updates.iterVersions(
"""<a><b class="release-info">
<c class="release-version">1.0.blurdy</c>
<x href="http://www.example.com/" class="announcement-url" />
<woot href="http://www.example.com/download.zip" class="download-the-bestest">Woot!</woot>
</b></a>"""
        ))
        self.failUnlessEqual(
            result, [
                ("1.0.blurdy",
                { "the-bestest": "http://www.example.com/download.zip"},
                "http://www.example.com/",
                None)
            ]
        )
    def testMultipleLangs(self):
        save_locale = PyICU.Locale.getDefault()

        PyICU.Locale.setDefault(PyICU.Locale.createFromName('fr_FR'))

        try:
            result = list(
                updates.iterVersions("""<a><b class="release-info">
    <c class="release-version">1.0.blurdy</c>
    <x href="http://www.example.com/" class="announcement-url" />
    <woot href="http://www.example.com/download.zip" class="download-the-bestest">Woot!</woot>
    <aha class="release-new-features">Now with vim &amp; verve</aha>
    <x class="release-new-features" lang="fr">Bonjour, mesdames et messieurs</x>
    </b></a>"""))
            self.failUnlessEqual(result, [("1.0.blurdy", {
                "the-bestest":
                "http://www.example.com/download.zip"
            }, "http://www.example.com/", "Bonjour, mesdames et messieurs")])
        finally:
            if save_locale is not None:
                PyICU.Locale.setDefault(save_locale)
    def testCurrent(self):
        result = list(
            updates.iterVersions(
                """<div class="release-info" id="chandler-0.7.5.1">
<h1>Download Chandler Desktop <span class="release-version">0.7.5.1</span></h1>
<p />
<h2><a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_win_0.7.5.1.exe" target="_top" class="download-windows">Windows</a> |
<a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/#enduserlinux" target="_top">Linux</a> |
Mac OS X:
<a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_ppc-osx_0.7.5.1.dmg" target="_top" class="download-osx-ppc">PPC</a> |
<a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_intel-osx_0.7.5.1.dmg" target="_top" class="download-osx-intel">Intel</a> | <a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_intel-osx-leopard_0.7.5.1.dmg" target="_top" class="download-osx-intel-10.5">Leopard</a> </h2>
<a href="http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_linux_0.7.5.1-1_i386.deb" class="download-linux" style="display:none"></a>
<p />
<div style="display:none">
<div class="release-new-features" lang="en">Drag-and-droppable sidebar collections</div>
</div>
<h3><a href="http://blog.chandlerproject.org/2008/03/26/chandler-0751/" class="announcement-url">Release announcement and notes for 0.7.5.1</a> </h3>
</div>
"""))
        self.failUnlessEqual(len(result), 1)

        t = result[0]
        self.failUnlessEqual(t[0], '0.7.5.1')
        self.failUnlessEqual(
            t[2], 'http://blog.chandlerproject.org/2008/03/26/chandler-0751/')
        self.failUnlessEqual(
            t[1], {
                'linux':
                'http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_linux_0.7.5.1-1_i386.deb',
                'osx-ppc':
                'http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_ppc-osx_0.7.5.1.dmg',
                'osx-intel-10.5':
                'http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_intel-osx-leopard_0.7.5.1.dmg',
                'osx-intel':
                'http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_intel-osx_0.7.5.1.dmg',
                'windows':
                'http://downloads.osafoundation.org/chandler/releases/0.7.5.1/Chandler_win_0.7.5.1.exe',
            })
        self.failUnlessEqual(t[3], "Drag-and-droppable sidebar collections")
Ejemplo n.º 10
0
 def testNoReleases(self):
     self.failUnlessEqual(list(updates.iterVersions("<x><y /></x>")), [])
Ejemplo n.º 11
0
 def testInvalidXML(self):
     self.failUnlessRaises(SyntaxError, lambda: list(updates.iterVersions("woot")))
Ejemplo n.º 12
0
    def testNoReleaseVersion(self):
        result = list(
            updates.iterVersions("""<a><b class="release-info">
<x href="http://www.example.com/" class="announcement-url" />
</b></a>"""))
        self.failUnlessEqual(result, [])
Ejemplo n.º 13
0
 def testNoReleases(self):
     self.failUnlessEqual(list(updates.iterVersions("<x><y /></x>")), [])
Ejemplo n.º 14
0
 def testInvalidXML(self):
     self.failUnlessRaises(SyntaxError,
                           lambda: list(updates.iterVersions("woot")))