Example #1
0
 def test_unicode_keywords_function(self):
     """ Test unicode keywords function. """
     error = None
     unicode_dict = {u_('hello'): 'world'}
     try:
         some_function(**unicode_dict)
     except Exception:
         error = sys.exc_info()[1]
     if type(error) is TypeError:
         unify_keys(unicode_dict)
         some_function(**unicode_dict)
Example #2
0
 def test_u_(self):
     """ Test get_uuid function. """
     u_("hello world!")
Example #3
0
Copyright (C) 2013 CERN
"""
import sys
import unittest

from mtb.conf import unify_keys, TreeDict
from mtb.string import u_
from mtb.test import parametrized


UNIFY_KEYS_SETS_NAMES = "error given result".split()
UNIFY_KEYS_SETS = (
    (None, None, None),
    (None, "", ""),
    (None, {'hello': 'world'}, {'hello': 'world'}),
    (None, {u_('hello'): 'world'}, {'hello': 'world'}),
    (None, {u_('hello'): 'world', 'foo': {u_('hello'): 'world'}},
     {'hello': 'world', 'foo': {'hello': 'world'}}),
)


class ConfTest(unittest.TestCase):
    """ Test :py:mod:`mtb.conf` utilities module. """

    def test_unicode_keywords_function(self):
        """ Test unicode keywords function. """
        error = None
        unicode_dict = {u_('hello'): 'world'}
        try:
            some_function(**unicode_dict)
        except Exception: