[Python-Dev] 2.3.1 is (almost) a go (original) (raw)
Jeff Epler jepler at unpythonic.net
Wed Sep 24 08:19:20 EDT 2003
- Previous message: [Python-Dev] 2.3.1 is (almost) a go
- Next message: [Python-Dev] 2.3.1 is (almost) a go
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Sep 24, 2003 at 07:10:51AM -0500, Jeff Epler wrote:
Perhaps a better way to fix it would be to test for a superset in testmimetypes. assert set(all) >= set('.bat', ...)
The general idea is implemented in this patch:
--- test_mimetypes.py.orig 2003-09-24 07:11:12.000000000 -0500 +++ test_mimetypes.py 2003-09-24 07🔞58.000000000 -0500 @@ -1,18 +1,21 @@ import mimetypes import StringIO import unittest +import sets from test import test_support -# Tell it we don't know about external files: -mimetypes.knownfiles = [] -mimetypes.inited = False
- class MimeTypesTestCase(unittest.TestCase): def setUp(self): self.db = mimetypes.MimeTypes()
- def assertSuperset(self, first, second, msg=None):
first = sets.Set(first)
second = sets.Set(second)
if not first >= second:
raise self.failureException, \
(msg or '%r >= %r' % (first, second))
def test_default_data(self): eq = self.assertEqual eq(self.db.guess_type("foo.html"), ("text/html", None))
@@ -45,15 +48,16 @@ eq(self.db.guess_extension('image/jpg', strict=False), '.jpg')
def test_guess_all_types(self):
ss = self.assertSuperset eq = self.assertEqual # First try strict all = self.db.guess_all_extensions('text/plain', strict=True) all.sort()
eq(all, ['.bat', '.c', '.h', '.ksh', '.pl', '.txt'])
ss(all, ['.bat', '.c', '.h', '.ksh', '.pl', '.txt']) # And now non-strict all = self.db.guess_all_extensions('image/jpg', strict=False) all.sort()
eq(all, ['.jpg'])
ss(all, ['.jpg']) # And now for no hits all = self.db.guess_all_extensions('image/jpg', strict=True) eq(all, [])
- Previous message: [Python-Dev] 2.3.1 is (almost) a go
- Next message: [Python-Dev] 2.3.1 is (almost) a go
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]