Example #1
0
    def test_sequential_conflicts(self):
        self.assertEqual([
            "         0",
            "         1",
            "         2",
            "         3",
            "         4",
            "         5",
            "         6",
            "         7",
            "         8",
            "         9",
            "        10",
        ],
                         params.build_conflicting_ids(
                             params.IndexIdConflict.SequentialConflicts, 11,
                             0))

        self.assertEqual([
            "         5",
            "         6",
            "         7",
            "         8",
            "         9",
            "        10",
            "        11",
            "        12",
            "        13",
            "        14",
            "        15",
        ],
                         params.build_conflicting_ids(
                             params.IndexIdConflict.SequentialConflicts, 11,
                             5))
Example #2
0
    def test_sequential_conflicts(self):
        self.assertEqual(
            [
                "         0",
                "         1",
                "         2",
                "         3",
                "         4",
                "         5",
                "         6",
                "         7",
                "         8",
                "         9",
                "        10",
            ],
            params.build_conflicting_ids(params.IndexIdConflict.SequentialConflicts, 11, 0)
        )

        self.assertEqual(
            [
                "         5",
                "         6",
                "         7",
                "         8",
                "         9",
                "        10",
                "        11",
                "        12",
                "        13",
                "        14",
                "        15",
            ],
            params.build_conflicting_ids(params.IndexIdConflict.SequentialConflicts, 11, 5)
        )
Example #3
0
 def test_build_conflicting_ids(self):
     self.assertIsNone(
         params.build_conflicting_ids(params.IndexIdConflict.NoConflicts, 3,
                                      0))
     self.assertEqual(["         0", "         1", "         2"],
                      params.build_conflicting_ids(
                          params.IndexIdConflict.SequentialConflicts, 3, 0))
     # we cannot tell anything specific about the contents...
     self.assertEqual(
         3,
         len(
             params.build_conflicting_ids(
                 params.IndexIdConflict.RandomConflicts, 3, 0)))
Example #4
0
    def test_random_conflicts(self):
        self.assertEqual(["         3", "         3", "         3"],
                         params.build_conflicting_ids(
                             params.IndexIdConflict.RandomConflicts,
                             3,
                             0,
                             rand=lambda x, y: y))

        self.assertEqual(["         8", "         8", "         8"],
                         params.build_conflicting_ids(
                             params.IndexIdConflict.RandomConflicts,
                             3,
                             5,
                             rand=lambda x, y: y))
Example #5
0
    def test_random_conflicts(self):
        self.assertEqual(
            [
                "         3",
                "         3",
                "         3"
            ],
            params.build_conflicting_ids(params.IndexIdConflict.RandomConflicts, 3, 0, rand=lambda x, y: y)
        )

        self.assertEqual(
            [
                "         8",
                "         8",
                "         8"
            ],
            params.build_conflicting_ids(params.IndexIdConflict.RandomConflicts, 3, 5, rand=lambda x, y: y)
        )
Example #6
0
 def test_no_id_conflicts(self):
     self.assertIsNone(params.build_conflicting_ids(None, 100, 0))
     self.assertIsNone(
         params.build_conflicting_ids(params.IndexIdConflict.NoConflicts,
                                      100, 0))
Example #7
0
 def test_no_id_conflicts(self):
     self.assertIsNone(params.build_conflicting_ids(None, 100, 0))
     self.assertIsNone(params.build_conflicting_ids(params.IndexIdConflict.NoConflicts, 100, 0))
Example #8
0
 def test_build_conflicting_ids(self):
     self.assertIsNone(params.build_conflicting_ids(params.IndexIdConflict.NoConflicts, 3, 0))
     self.assertEqual(["         0", "         1", "         2"],
                      params.build_conflicting_ids(params.IndexIdConflict.SequentialConflicts, 3, 0))
     # we cannot tell anything specific about the contents...
     self.assertEqual(3, len(params.build_conflicting_ids(params.IndexIdConflict.RandomConflicts, 3, 0)))