Exemple #1
0
 def test__get_form_indicies(self):
     data = (
         (  # 1
             (0, ([], False)),
             (1, ([0], False)),
             (2, ([0], False)),
         ),
         (  # 2
             (0, ([], False)),
             (1, ([0], True)),
             (2, ([0, 1], False)),
         ),
         (  # 3
             (0, ([], False)),
             (1, ([1], False)),
             (2, ([0, 2], False)),
             (3, ([0, 1, 2], False)),
         ),
         (  # 4
             (0, ([], False)),
             (1, ([1], True)),
             (2, ([1, 2], False)),
             (3, ([0, 1, 2], True)),
             (4, ([0, 1, 2, 3], False)),
         ),
         (  # 5
             (0, ([], False)),
             (1, ([2], False)),
             (2, ([1, 3], False)),
             (3, ([1, 2, 3], False)),
             (4, ([0, 1, 3, 4], False)),
             (5, ([0, 1, 2, 3, 4], False)),
         ),
         (  # 6
             (0, ([], False)),
             (1, ([2], True)),
             (2, ([2, 3], False)),
             (3, ([1, 2, 3], True)),
             (4, ([1, 2, 3, 4], False)),
             (5, ([0, 1, 2, 3, 4], True)),
             (6, ([0, 1, 2, 3, 4, 5], False)),
         )
     )
     for i, group in enumerate(data):
         values = [list(range(i + 1))]
         for depth, expected in group:
             vals = _get_form_indices(values, depth)
             self.assertEqual(vals, expected)
Exemple #2
0
 def test__get_form_indicies(self):
     data = (
         (  # 1
             (0, ([], False)),
             (1, ([0], False)),
             (2, ([0], False)),
         ),
         (  # 2
             (0, ([], False)),
             (1, ([0], True)),
             (2, ([0, 1], False)),
         ),
         (  # 3
             (0, ([], False)),
             (1, ([1], False)),
             (2, ([0, 2], False)),
             (3, ([0, 1, 2], False)),
         ),
         (  # 4
             (0, ([], False)),
             (1, ([1], True)),
             (2, ([1, 2], False)),
             (3, ([0, 1, 2], True)),
             (4, ([0, 1, 2, 3], False)),
         ),
         (  # 5
             (0, ([], False)),
             (1, ([2], False)),
             (2, ([1, 3], False)),
             (3, ([1, 2, 3], False)),
             (4, ([0, 1, 3, 4], False)),
             (5, ([0, 1, 2, 3, 4], False)),
         ),
         (  # 6
             (0, ([], False)),
             (1, ([2], True)),
             (2, ([2, 3], False)),
             (3, ([1, 2, 3], True)),
             (4, ([1, 2, 3, 4], False)),
             (5, ([0, 1, 2, 3, 4], True)),
             (6, ([0, 1, 2, 3, 4, 5], False)),
         )
     )
     for i, group in enumerate(data):
         values = [list(range(i + 1))]
         for depth, expected in group:
             vals = _get_form_indices(values, depth)
             self.assertEqual(vals, expected)
Exemple #3
0
 def test__get_form_indicies_invalid(self):
     with self.assertRaises(ValueError):
         _get_form_indices([], 1)
Exemple #4
0
 def test__get_form_indicies_invalid(self):
     with self.assertRaises(ValueError):
         _get_form_indices([], 1)