def test_section_num_incr_sub2(self) -> None: # {{{1 from common import section_num_incr_desc as dut self.assertEqual("0a", dut("0")) self.assertEqual("9a", dut("9")) self.assertEqual("99a", dut("99")) self.assertEqual("0-0a", dut("0-0")) self.assertEqual("0-0aa", dut("0-0z")) self.assertEqual("999-999a", dut("999-999"))
def test_compose_script(self) -> None: # {{{1 from common import compose_script as dut ans = dut("doc") from common import quote_attr as dut2 ans = dut2(ans) exp = os.path.join(os.path.dirname(__file__), "fmmulti.py") # output from freemind 1.1.0beta2 exp = """cur = c.getMap()
fname = cur.getFile().getPath()
fnout = fname + "-doc.mm"
cmd = "python3 {} -i " + fname
cmd = cmd + " -o " + fnout
cmd = cmd + " -m doc"
print(cmd + "\\n")
proc = cmd.execute()
proc.waitForOrKill(5000)""".format(exp) exp = re.sub("\n +", " ", exp) # strip indent self.assertEqual(exp, ans)
def test_section_num_recv(self) -> None: # {{{1 from common import section_num_recv as dut self.assertEqual("a", dut(0)) self.assertEqual("a", dut(1)) # 0 self.assertEqual("b", dut(2)) # 1 self.assertEqual("y", dut(25)) # 24 self.assertEqual("z", dut(26)) # 25 self.assertEqual("aa", dut(27)) # 1, 0 self.assertEqual("ab", dut(28)) # 1, 1 self.assertEqual("az", dut(52)) # 1, 25 self.assertEqual("ba", dut(53)) self.assertEqual("bz", dut(78)) self.assertEqual("ca", dut(79)) self.assertEqual("ma", dut(339)) self.assertEqual("yy", dut(675)) self.assertEqual("yz", dut(676)) self.assertEqual("zy", dut(701)) self.assertEqual("zz", dut(702)) self.assertEqual("aaa", dut(703)) self.assertEqual("zzz", dut(18278)) self.assertEqual("aaaa", dut(18279))
def test_section_num_incr_sub1(self) -> None: # {{{1 from common import section_num_incr_desc as dut self.assertEqual("a", dut("")) self.assertEqual("b", dut("a")) self.assertEqual("z", dut("y")) self.assertEqual("aa", dut("z")) self.assertEqual("ab", dut("aa")) self.assertEqual("ba", dut("az")) self.assertEqual("ca", dut("bz")) self.assertEqual("mn", dut("mm")) self.assertEqual("yz", dut("yy")) self.assertEqual("za", dut("yz")) self.assertEqual("zy", dut("zx")) self.assertEqual("zz", dut("zy")) self.assertEqual("aaa", dut("zz"))
def test_section_num_conv(self) -> None: # {{{1 from common import section_num_conv as dut self.assertEqual(0, dut("")) self.assertEqual(1, dut("a")) self.assertEqual(2, dut("b")) self.assertEqual(25, dut("y")) self.assertEqual(26, dut("z")) self.assertEqual(27, dut("aa")) self.assertEqual(52, dut("az")) self.assertEqual(53, dut("ba")) self.assertEqual(78, dut("bz")) self.assertEqual(79, dut("ca")) self.assertEqual(339, dut("ma")) self.assertEqual(675, dut("yy")) self.assertEqual(676, dut("yz")) self.assertEqual(701, dut("zy")) self.assertEqual(702, dut("zz")) self.assertEqual(703, dut("aaa"))