Пример #1
0
    def test_reverse(self):
        order1 = meta.Order(True)
        order1.reverse()
        self.assertFalse(order1.asc)

        order2 = meta.Order(False)
        order2.reverse()
        self.assertTrue(order2.asc)
Пример #2
0
    def test_reversed(self):
        order1 = meta.Order(True)
        order2 = order1.reversed()
        self.assertIsInstance(order2, meta.Order)
        self.assertIsNot(order1, order2)
        self.assertTrue(order1.asc)
        self.assertFalse(order2.asc)

        self.assertTrue(meta.Order(False).reversed().asc)
Пример #3
0
 def test_str(self):
     self.assertEqual('ASC', str(meta.Order()))
     self.assertEqual('DESC', str(meta.Order(False)))
Пример #4
0
 def test_prefix(self):
     self.assertEqual('', meta.Order().prefix)
     self.assertEqual('-', meta.Order(False).prefix)
Пример #5
0
 def test_desc(self):
     self.assertIs(meta.Order().desc, False)
     self.assertIs(meta.Order(False).desc, True)