~ubuntu-branches/ubuntu/precise/python3.2/precise-proposed

« back to all changes in this revision

Viewing changes to Lib/test/test_mimetypes.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-03-09 18:40:39 UTC
  • mfrom: (30.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120309184039-j3yk2emxr1plyo21
Tags: 3.2.3~rc1-1
* Python 3.2.3 release candidate 1.
* Update to 20120309 from the 3.2 branch.
* Fix libpython.a symlink. Closes: #660146.
* Build-depend on xauth.
* Run the gdb tests for the debug build only.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import io
 
2
import locale
1
3
import mimetypes
2
 
import io
 
4
import sys
3
5
import unittest
4
 
import sys
5
6
 
6
7
from test import support
7
8
 
62
63
        all = self.db.guess_all_extensions('image/jpg', strict=True)
63
64
        eq(all, [])
64
65
 
 
66
    def test_encoding(self):
 
67
        getpreferredencoding = locale.getpreferredencoding
 
68
        self.addCleanup(setattr, locale, 'getpreferredencoding',
 
69
                                 getpreferredencoding)
 
70
        locale.getpreferredencoding = lambda: 'ascii'
 
71
 
 
72
        filename = support.findfile("mime.types")
 
73
        mimes = mimetypes.MimeTypes([filename])
 
74
        exts = mimes.guess_all_extensions('application/vnd.geocube+xml',
 
75
                                          strict=True)
 
76
        self.assertEqual(exts, ['.g3', '.g\xb3'])
 
77
 
65
78
 
66
79
@unittest.skipUnless(sys.platform.startswith("win"), "Windows only")
67
80
class Win32MimeTypesTestCase(unittest.TestCase):