@@ -0,0 +1,1845 @@
+# -*- coding: utf-8 -*-%0A#%0A# This file is part of BridgeDB, a Tor bridge distribution system.%0A#%0A# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 %3Cisis@torproject.org%3E%0A#           please also see AUTHORS file%0A# :copyright: (c) 2014, Isis Lovecruft%0A#             (c) 2007-2014, The Tor Project, Inc.%0A#             (c) 2007-2014, all entities within the AUTHORS file%0A# :license: see LICENSE for licensing information%0A%0A%22%22%22Unittests for the :mod:%60bridgedb.parse.headers%60 module.%22%22%22%0A%0Afrom __future__ import absolute_import%0Afrom __future__ import print_function%0Afrom __future__ import unicode_literals%0A%0Afrom twisted.trial import unittest%0A%0Afrom bridgedb.parse import headers%0A%0A%0Aclass ParseAcceptLanguageTests(unittest.TestCase):%0A    %22%22%22Unittests for :func:%60bridgedb.parse.headers.parseAcceptLanguage%60.%22%22%22%0A%0A    def test_noHeaders(self):%0A        %22%22%22No header should return an empty list.%22%22%22%0A        header = None%0A        langs = headers.parseAcceptLanguage(header)%0A        self.assertIsInstance(langs, list)%0A        self.assertEqual(len(langs), 0)%0A%0A    def test_defaultTBBHeader(self):%0A        %22%22%22The header 'en-us,en;q=0.5' should return %5B'en_us', 'en'%5D.%22%22%22%0A        header = 'en-us,en;q=0.5'%0A        langs = headers.parseAcceptLanguage(header)%0A        self.assertIsInstance(langs, list)%0A        self.assertEqual(len(langs), 2)%0A        self.assertEqual(langs%5B0%5D, 'en_us')%0A        self.assertEqual(langs%5B1%5D, 'en')%0A%0A    def test_addNonLocalizedVariant(self):%0A        %22%22%22The header 'en-us,en-gb;q=0.5' should return%0A        %5B'en_us', 'en', 'en_gb'%5D.%0A        %22%22%22%0A        header = 'en-us,en-gb;q=0.5'%0A        langs = headers.parseAcceptLanguage(header)%0A        self.assertIsInstance(langs, list)%0A        self.assertEqual(len(langs), 3)%0A        self.assertEqual(langs%5B0%5D, 'en_us')%0A        self.assertEqual(langs%5B1%5D, 'en')%0A        self.assertEqual(langs%5B2%5D, 'en_gb')%0A

Add unittests for bridgedb.parse.headers.parseAcceptLanguage().