Ejemplo n.º 1
0
 def test_import_priorities_compare(self):
     self.assertEqual(compare_import_priorities([0], [0]), 0)
     self.assertEqual(compare_import_priorities([2], [0]), -1)
     self.assertEqual(compare_import_priorities([0, 1], [0]), -1)
     self.assertEqual(compare_import_priorities([0, 1], [0, 1]), 0)
     self.assertEqual(compare_import_priorities([0], [0, 1]), 1)
     self.assertEqual(compare_import_priorities([0, 1, 1], [0, 1, 1]), 0)
     self.assertEqual(compare_import_priorities([0], [1]), 1)
     self.assertEqual(compare_import_priorities([0], [1000]), 1)
     self.assertEqual(compare_import_priorities([0, 0, 0, 1], [0, 0, 0, 2]), 1)
     self.assertEqual(compare_import_priorities([1, 2, 0, 0], [1, 2, 0]), -1)
Ejemplo n.º 2
0
 def test_import_priorities_compare(self):
     self.assertEqual(compare_import_priorities([0], [0]), 0)
     self.assertEqual(compare_import_priorities([2], [0]), -1)
     self.assertEqual(compare_import_priorities([0, 1], [0]), -1)
     self.assertEqual(compare_import_priorities([0, 1], [0, 1]), 0)
     self.assertEqual(compare_import_priorities([0], [0, 1]), 1)
     self.assertEqual(compare_import_priorities([0, 1, 1], [0, 1, 1]), 0)
     self.assertEqual(compare_import_priorities([0], [1]), 1)
     self.assertEqual(compare_import_priorities([0], [1000]), 1)
     self.assertEqual(compare_import_priorities([0, 0, 0, 1], [0, 0, 0, 2]),
                      1)
     self.assertEqual(compare_import_priorities([1, 2, 0, 0], [1, 2, 0]),
                      -1)
Ejemplo n.º 3
0
def sort_by_priority(template1, template2):
    return compare_import_priorities(template1.i_priority, template2.i_priority)
Ejemplo n.º 4
0
def sort_by_priority(template1, template2):
    return compare_import_priorities(template1.i_priority,
                                     template2.i_priority)