示例#1
0
 def test_retrieving_non_existing_localized_names(self):
     """
     When a non-existing localized name is requested, a warning must be 
     issued and the global name returned.
     
     """
     bind = Bind("foo", String("hey"), es="fulano")
     logging_fixture = LoggingHandlerFixture()
     eq_(bind.get_localized_name("fr"), "foo")
     # Checking for the the warning:
     eq_(len(logging_fixture.handler.messages["warning"]), 1)
     warning = logging_fixture.handler.messages["warning"][0]
     eq_(warning, 'Operand "hey" bound as "foo" doesn\'t have a name in fr; '
                  'using the global one')
     # Undoing it:
     logging_fixture.undo()
示例#2
0
    def test_retrieving_non_existing_localized_names(self):
        """
        When a non-existing localized name is requested, a warning must be
        issued and the global name returned.

        """
        bind = Bind("foo", String("hey"), es="fulano")
        logging_fixture = LoggingHandlerFixture()
        eq_(bind.get_localized_name("fr"), "foo")
        # Checking for the the warning:
        eq_(len(logging_fixture.handler.messages["warning"]), 1)
        warning = logging_fixture.handler.messages["warning"][0]
        eq_(
            warning,
            'Operand "hey" bound as "foo" doesn\'t have a name in fr; '
            'using the global one')
        # Undoing it:
        logging_fixture.undo()
示例#3
0
 def test_retrieving_existing_localized_names(self):
     bind = Bind("foo", String("hey"), es="fulano")
     eq_(bind.get_localized_name("es"), "fulano")
示例#4
0
 def test_retrieving_existing_localized_names(self):
     bind = Bind("foo", String("hey"), es="fulano")
     eq_(bind.get_localized_name("es"), "fulano")