本文整理匯總了Python中quodlibet.qltk.cbes.ComboBoxEntrySave.append_text方法的典型用法代碼示例。如果您正苦於以下問題:Python ComboBoxEntrySave.append_text方法的具體用法?Python ComboBoxEntrySave.append_text怎麽用?Python ComboBoxEntrySave.append_text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類quodlibet.qltk.cbes.ComboBoxEntrySave
的用法示例。
在下文中一共展示了ComboBoxEntrySave.append_text方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TComboBoxEntrySave
# 需要導入模塊: from quodlibet.qltk.cbes import ComboBoxEntrySave [as 別名]
# 或者: from quodlibet.qltk.cbes.ComboBoxEntrySave import append_text [as 別名]
class TComboBoxEntrySave(TestCase):
memory = "pattern 1\npattern 2\n"
saved = "pattern text\npattern name\n"
def setUp(self):
quodlibet.config.init()
self.fname = tempfile.mkstemp()[1]
f = file(self.fname, "w")
f.write(self.memory)
f.close()
f = file(self.fname + ".saved", "w")
f.write(self.saved)
f.close()
self.cbes = ComboBoxEntrySave(self.fname, count=2)
self.cbes2 = ComboBoxEntrySave(self.fname, count=2)
def test_equivalence(self):
model1 = self.cbes.get_model()
model2 = self.cbes2.get_model()
self.failUnlessEqual(model1, model2)
rows1 = list(model1)
rows2 = list(model2)
for row1, row2 in zip(rows1, rows2):
self.failUnlessEqual(row1[0], row2[0])
self.failUnlessEqual(row1[1], row2[1])
self.failUnlessEqual(row1[2], row2[2])
def test_shared_model(self):
self.cbes.append_text("a test")
self.test_equivalence()
def test_initial_size(self):
# 1 saved, Edit, separator, 2 remembered
self.failUnlessEqual(5, len(self.cbes.get_model()))
def test_prepend_text(self):
self.cbes.prepend_text("pattern 3")
self.memory = "pattern 3\npattern 1\n"
self.test_save()
def test_save(self):
self.cbes.write()
self.failUnlessEqual(self.memory, file(self.fname).read())
self.failUnlessEqual(self.saved, file(self.fname + ".saved").read())
def test_set_text_then_prepend(self):
self.cbes.child.set_text("foobar")
self.cbes.prepend_text("foobar")
self.memory = "foobar\npattern 1\n"
self.test_save()
def tearDown(self):
self.cbes.destroy()
self.cbes2.destroy()
os.unlink(self.fname)
os.unlink(self.fname + ".saved")
quodlibet.config.quit()