test_lessonfile.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:Solfege 作者: RannyeriDev 项目源码 文件源码
def _worker_Xrandom(self, rfunc):
        styles = ["8beat", "ballad", "rock"]
        s = """
        styles = %s
        question {
            style = %s("8beat", "ballad")
        }
        question {
            style = %s(styles)
        }
        """ % (", ".join(['"%s"' % x for x in styles]), rfunc, rfunc)
        self.p = QuestionsLessonfile()
        p = self.do_file(s)
        for idx in range(2):
            st = p.m_questions[idx]['style']
            for x in range(20):
                self.assert_(str(st) in styles)
                self.assert_(unicode(st) in styles)
                st.randomize()
            # This test only works with nrandom, because prandom will
            # return a possible different value every time.
            if rfunc == 'nrandom':
                l = Gtk.Label(label=st)
                self.assert_(l.get_text() == unicode(st), "%s and gtk does not cooperate." % rfunc)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号