Пример #1
0
    def test_loop(self):
        m = StoredQueriesModel()
        m.page = 1
        m.label = 'l=1'
        m.tooltip = 't=1'
        m.query = 'q=1'
        m.page = 2
        m.label = 'l=2'
        m.tooltip = 't=2'
        m.query = 'q=2'

        self.assertEquals(m[1], 'l=1:t=1:q=1')
        self.assertEquals(m[2], 'l=2:t=2:q=2')
        self.assertEquals(m[3], '::')

        self.assertEquals([i for i in m], [u'l=1:t=1:q=1',
                                           u'l=2:t=2:q=2',
                                           u'::',
                                           u'::',
                                           u'::',
                                           u'::',
                                           u'::',
                                           u'::',
                                           u'::',
                                           u'::'])
Пример #2
0
 def test_define_label(self):
     m = StoredQueriesModel()
     m.label = 'n=1'
     self.assertEquals(m.label, 'n=1')
     m.page = 2
     self.assertEquals(m.label, '')
     m.label = 'n=2'
     self.assertEquals(m.label, 'n=2')
     m.page = 1
     self.assertEquals(m.label, 'n=1')
 def test_define_label(self):
     m = StoredQueriesModel()
     m.label = 'n=1'
     self.assertEquals(m.label, 'n=1')
     m.page = 2
     self.assertEquals(m.label, '')
     m.label = 'n=2'
     self.assertEquals(m.label, 'n=2')
     m.page = 1
     self.assertEquals(m.label, 'n=1')
    def test_loop(self):
        m = StoredQueriesModel()
        m.page = 1
        m.label = 'l=1'
        m.tooltip = 't=1'
        m.query = 'q=1'
        m.page = 2
        m.label = 'l=2'
        m.tooltip = 't=2'
        m.query = 'q=2'

        self.assertEquals(m[1], 'l=1:t=1:q=1')
        self.assertEquals(m[2], 'l=2:t=2:q=2')
        self.assertEquals(m[3], '::')

        self.assertEquals([i for i in m], [
            u'l=1:t=1:q=1', u'l=2:t=2:q=2', u'::', u'::', u'::', u'::', u'::',
            u'::', u'::', u'::'
        ])