Run 2to3.

This commit is contained in:
Ryan Stein 2017-10-29 13:40:30 -04:00
parent a5a8d9dd57
commit 6fa280b9fd
157 changed files with 976 additions and 976 deletions

View file

@ -10,46 +10,46 @@ class TestEvForm(TestCase):
def test_form(self):
self.maxDiff = None
self.assertEqual(evform._test(),
u'.------------------------------------------------.\n'
u'| |\n'
u'| Name: \x1b[0m\x1b[1m\x1b[32mTom\x1b[1m\x1b[32m \x1b'
u'[1m\x1b[32mthe\x1b[1m\x1b[32m \x1b[0m \x1b[0m '
u'Account: \x1b[0m\x1b[1m\x1b[33mGriatch '
u'\x1b[0m\x1b[0m\x1b[1m\x1b[32m\x1b[1m\x1b[32m\x1b[1m\x1b[32m\x1b[1m\x1b[32m\x1b[0m\x1b[0m '
u'|\n'
u'| \x1b[0m\x1b[1m\x1b[32mBouncer\x1b[0m \x1b[0m |\n'
u'| |\n'
u' >----------------------------------------------<\n'
u'| |\n'
u'| Desc: \x1b[0mA sturdy \x1b[0m \x1b[0m'
u' STR: \x1b[0m12 \x1b[0m\x1b[0m\x1b[0m\x1b[0m'
u' DEX: \x1b[0m10 \x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
u'| \x1b[0mfellow\x1b[0m \x1b[0m'
u' INT: \x1b[0m5 \x1b[0m\x1b[0m\x1b[0m\x1b[0m'
u' STA: \x1b[0m18 \x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
u'| \x1b[0m \x1b[0m'
u' LUC: \x1b[0m10 \x1b[0m\x1b[0m\x1b[0m'
u' MAG: \x1b[0m3 \x1b[0m\x1b[0m\x1b[0m |\n'
u'| |\n'
u' >----------.-----------------------------------<\n'
u'| | |\n'
u'| \x1b[0mHP\x1b[0m|\x1b[0mMV \x1b[0m|\x1b[0mMP\x1b[0m '
u'| \x1b[0mSkill \x1b[0m|\x1b[0mValue \x1b[0m'
u'|\x1b[0mExp \x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
u'| ~~+~~~+~~ | ~~~~~~~~~~~+~~~~~~~~~~+~~~~~~~~~~~ |\n'
u'| \x1b[0m**\x1b[0m|\x1b[0m***\x1b[0m\x1b[0m|\x1b[0m**\x1b[0m\x1b[0m '
u'| \x1b[0mShooting \x1b[0m|\x1b[0m12 \x1b[0m'
u'|\x1b[0m550/1200 \x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
u'| \x1b[0m \x1b[0m|\x1b[0m**\x1b[0m \x1b[0m|\x1b[0m*\x1b[0m \x1b[0m '
u'| \x1b[0mHerbalism \x1b[0m|\x1b[0m14 \x1b[0m'
u'|\x1b[0m990/1400 \x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
u'| \x1b[0m \x1b[0m|\x1b[0m \x1b[0m|\x1b[0m \x1b[0m '
u'| \x1b[0mSmithing \x1b[0m|\x1b[0m9 \x1b[0m'
u'|\x1b[0m205/900 \x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
u'| | |\n'
u' -----------`-------------------------------------\n')
'.------------------------------------------------.\n'
'| |\n'
'| Name: \x1b[0m\x1b[1m\x1b[32mTom\x1b[1m\x1b[32m \x1b'
'[1m\x1b[32mthe\x1b[1m\x1b[32m \x1b[0m \x1b[0m '
'Account: \x1b[0m\x1b[1m\x1b[33mGriatch '
'\x1b[0m\x1b[0m\x1b[1m\x1b[32m\x1b[1m\x1b[32m\x1b[1m\x1b[32m\x1b[1m\x1b[32m\x1b[0m\x1b[0m '
'|\n'
'| \x1b[0m\x1b[1m\x1b[32mBouncer\x1b[0m \x1b[0m |\n'
'| |\n'
' >----------------------------------------------<\n'
'| |\n'
'| Desc: \x1b[0mA sturdy \x1b[0m \x1b[0m'
' STR: \x1b[0m12 \x1b[0m\x1b[0m\x1b[0m\x1b[0m'
' DEX: \x1b[0m10 \x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
'| \x1b[0mfellow\x1b[0m \x1b[0m'
' INT: \x1b[0m5 \x1b[0m\x1b[0m\x1b[0m\x1b[0m'
' STA: \x1b[0m18 \x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
'| \x1b[0m \x1b[0m'
' LUC: \x1b[0m10 \x1b[0m\x1b[0m\x1b[0m'
' MAG: \x1b[0m3 \x1b[0m\x1b[0m\x1b[0m |\n'
'| |\n'
' >----------.-----------------------------------<\n'
'| | |\n'
'| \x1b[0mHP\x1b[0m|\x1b[0mMV \x1b[0m|\x1b[0mMP\x1b[0m '
'| \x1b[0mSkill \x1b[0m|\x1b[0mValue \x1b[0m'
'|\x1b[0mExp \x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
'| ~~+~~~+~~ | ~~~~~~~~~~~+~~~~~~~~~~+~~~~~~~~~~~ |\n'
'| \x1b[0m**\x1b[0m|\x1b[0m***\x1b[0m\x1b[0m|\x1b[0m**\x1b[0m\x1b[0m '
'| \x1b[0mShooting \x1b[0m|\x1b[0m12 \x1b[0m'
'|\x1b[0m550/1200 \x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
'| \x1b[0m \x1b[0m|\x1b[0m**\x1b[0m \x1b[0m|\x1b[0m*\x1b[0m \x1b[0m '
'| \x1b[0mHerbalism \x1b[0m|\x1b[0m14 \x1b[0m'
'|\x1b[0m990/1400 \x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
'| \x1b[0m \x1b[0m|\x1b[0m \x1b[0m|\x1b[0m \x1b[0m '
'| \x1b[0mSmithing \x1b[0m|\x1b[0m9 \x1b[0m'
'|\x1b[0m205/900 \x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m\x1b[0m |\n'
'| | |\n'
' -----------`-------------------------------------\n')
def test_ansi_escape(self):
# note that in a msg() call, the result would be the correct |-----,
# in a print, ansi only gets called once, so ||----- is the result
self.assertEqual(unicode(evform.EvForm(form={"FORM": "\n||-----"})), "||-----")
self.assertEqual(str(evform.EvForm(form={"FORM": "\n||-----"})), "||-----")

View file

@ -58,7 +58,7 @@ class TestEvMenu(TestCase):
def _debug_output(self, indent, msg):
if self.debug_output:
print(" " * indent + msg)
print((" " * indent + msg))
def _test_menutree(self, menu):
"""

View file

@ -15,8 +15,8 @@ class ANSIStringTestCase(TestCase):
Verifies the raw and clean strings of an ANSIString match expected
output.
"""
self.assertEqual(unicode(ansi.clean()), clean)
self.assertEqual(unicode(ansi.raw()), raw)
self.assertEqual(str(ansi.clean()), clean)
self.assertEqual(str(ansi.raw()), raw)
def table_check(self, ansi, char, code):
"""
@ -29,8 +29,8 @@ class ANSIStringTestCase(TestCase):
"""
Make sure the ANSIString is always constructed correctly.
"""
clean = u'This isA|r testTest'
encoded = u'\x1b[1m\x1b[32mThis is\x1b[1m\x1b[31mA|r test\x1b[0mTest\x1b[0m'
clean = 'This isA|r testTest'
encoded = '\x1b[1m\x1b[32mThis is\x1b[1m\x1b[31mA|r test\x1b[0mTest\x1b[0m'
target = ANSIString(r'|gThis is|rA||r test|nTest|n')
char_table = [9, 10, 11, 12, 13, 14, 15, 25, 26, 27, 28, 29, 30, 31, 32, 37, 38, 39, 40]
code_table = [0, 1, 2, 3, 4, 5, 6, 7, 8, 16, 17, 18, 19, 20, 21, 22, 23, 24, 33, 34, 35, 36, 41, 42, 43, 44]
@ -41,9 +41,9 @@ class ANSIStringTestCase(TestCase):
self.checker(ANSIString(encoded, decoded=True), encoded, clean)
self.table_check(ANSIString(encoded, decoded=True), char_table,
code_table)
self.checker(ANSIString('Test'), u'Test', u'Test')
self.checker(ANSIString('Test'), 'Test', 'Test')
self.table_check(ANSIString('Test'), [0, 1, 2, 3], [])
self.checker(ANSIString(''), u'', u'')
self.checker(ANSIString(''), '', '')
def test_slice(self):
"""
@ -52,24 +52,24 @@ class ANSIStringTestCase(TestCase):
"""
target = ANSIString(r'|gTest|rTest|n')
result = target[:3]
self.checker(result, u'\x1b[1m\x1b[32mTes', u'Tes')
self.checker(result, '\x1b[1m\x1b[32mTes', 'Tes')
result = target[:4]
self.checker(result, u'\x1b[1m\x1b[32mTest\x1b[1m\x1b[31m', u'Test')
self.checker(result, '\x1b[1m\x1b[32mTest\x1b[1m\x1b[31m', 'Test')
result = target[:]
self.checker(
result,
u'\x1b[1m\x1b[32mTest\x1b[1m\x1b[31mTest\x1b[0m',
u'TestTest')
'\x1b[1m\x1b[32mTest\x1b[1m\x1b[31mTest\x1b[0m',
'TestTest')
result = target[:-1]
self.checker(
result,
u'\x1b[1m\x1b[32mTest\x1b[1m\x1b[31mTes',
u'TestTes')
'\x1b[1m\x1b[32mTest\x1b[1m\x1b[31mTes',
'TestTes')
result = target[0:0]
self.checker(
result,
u'',
u'')
'',
'')
def test_split(self):
"""
@ -77,9 +77,9 @@ class ANSIStringTestCase(TestCase):
codes end up where they should.
"""
target = ANSIString("|gThis is |nA split string|g")
first = (u'\x1b[1m\x1b[32mThis is \x1b[0m', u'This is ')
second = (u'\x1b[1m\x1b[32m\x1b[0m split string\x1b[1m\x1b[32m',
u' split string')
first = ('\x1b[1m\x1b[32mThis is \x1b[0m', 'This is ')
second = ('\x1b[1m\x1b[32m\x1b[0m split string\x1b[1m\x1b[32m',
' split string')
re_split = re.split('A', target)
normal_split = target.split('A')
self.assertEqual(re_split, normal_split)
@ -97,11 +97,11 @@ class ANSIStringTestCase(TestCase):
l = [ANSIString("|gTest|r") for _ in range(0, 3)]
# Force the generator to be evaluated.
result = "".join(l)
self.assertEqual(unicode(result), u'TestTestTest')
self.assertEqual(str(result), 'TestTestTest')
result = ANSIString("").join(l)
self.checker(result, u'\x1b[1m\x1b[32mTest\x1b[1m\x1b[31m\x1b[1m\x1b'
u'[32mTest\x1b[1m\x1b[31m\x1b[1m\x1b[32mTest'
u'\x1b[1m\x1b[31m', u'TestTestTest')
self.checker(result, '\x1b[1m\x1b[32mTest\x1b[1m\x1b[31m\x1b[1m\x1b'
'[32mTest\x1b[1m\x1b[31m\x1b[1m\x1b[32mTest'
'\x1b[1m\x1b[31m', 'TestTestTest')
def test_len(self):
"""
@ -116,8 +116,8 @@ class ANSIStringTestCase(TestCase):
_transform functions.
"""
target = ANSIString('|gtest|n')
result = u'\x1b[1m\x1b[32mTest\x1b[0m'
self.checker(target.capitalize(), result, u'Test')
result = '\x1b[1m\x1b[32mTest\x1b[0m'
self.checker(target.capitalize(), result, 'Test')
def test_mxp_agnostic(self):
"""
@ -131,7 +131,7 @@ class ANSIStringTestCase(TestCase):
self.assertEqual(len(ANSIString(mxp1)), len(ANSIString(mxp1).split("\n")[0]))
self.assertEqual(len(ANSIString(mxp2)), len(ANSIString(mxp2).split("\n")[0]))
self.assertEqual(mxp1, ANSIString(mxp1))
self.assertEqual(mxp2, unicode(ANSIString(mxp2)))
self.assertEqual(mxp2, str(ANSIString(mxp2)))
def test_add(self):
"""
@ -140,8 +140,8 @@ class ANSIStringTestCase(TestCase):
a = ANSIString("|gTest")
b = ANSIString("|cString|n")
c = a + b
result = u'\x1b[1m\x1b[32mTest\x1b[1m\x1b[36mString\x1b[0m'
self.checker(c, result, u'TestString')
result = '\x1b[1m\x1b[32mTest\x1b[1m\x1b[36mString\x1b[0m'
self.checker(c, result, 'TestString')
char_table = [9, 10, 11, 12, 22, 23, 24, 25, 26, 27]
code_table = [0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 14, 15, 16, 17, 18, 19, 20, 21, 28, 29, 30, 31]
self.table_check(c, char_table, code_table)