On Python 3 the chr function returns unicode so trying to decode will result in an error. Applied a workaround to assign without decoding.
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
|
# See LICENSE for more details.
|
|
#
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
from twisted.trial import unittest
|
|
|
|
from deluge.ui.console.widgets.fields import TextInput
|
|
|
|
|
|
class Parent(object):
|
|
def __init__(self):
|
|
self.border_off_x = 1
|
|
self.pane_width = 20
|
|
self.encoding = 'utf8'
|
|
|
|
|
|
class UICommonTestCase(unittest.TestCase):
|
|
def setUp(self): # NOQA: N803
|
|
self.parent = Parent()
|
|
|
|
def tearDown(self): # NOQA: N803
|
|
pass
|
|
|
|
def test_text_input(self):
|
|
def move_func(self, r, c):
|
|
self._cursor_row = r
|
|
self._cursor_col = c
|
|
|
|
t = TextInput(
|
|
self.parent,
|
|
'name',
|
|
'message',
|
|
move_func,
|
|
20,
|
|
'/text/field/file/path',
|
|
complete=False,
|
|
)
|
|
self.assertTrue(t)
|
|
self.assertTrue(t.handle_read(33))
|