diff --git a/tests/unit/test_refinement_three_level_multipatch.py b/tests/unit/test_refinement_three_level_multipatch.py index 3a79569..38aa0cc 100644 --- a/tests/unit/test_refinement_three_level_multipatch.py +++ b/tests/unit/test_refinement_three_level_multipatch.py @@ -313,3 +313,20 @@ class ConstructorAndSchedule(unittest.TestCase): if __name__=='__main__': unittest.main() + + +class InitialLevels(unittest.TestCase): + """initialize() entry adapter: positional per-level arrays or the legacy names, never both.""" + + def test_forms(self): + a, b, c = object(), object(), object() + f = host._initial_levels + self.assertEqual(f((a, b), None, None, None), (a, b)) + self.assertEqual(f((a, b, c), None, None, None), (a, b, c)) + self.assertEqual(f((a, b), None, None, c), (a, b, c)) # old initialize(c, f, child_g=g) + self.assertEqual(f((), a, b, None), (a, b)) + self.assertEqual(f((), a, b, c), (a, b, c)) + for args in (((a,), None, None, c), ((a, b, c), None, None, c), ((a,), a, b, None), + ((), a, None, None), ((), None, b, c)): + with self.subTest(args=args), self.assertRaises(TypeError): + f(*args)