From 8fa9ac0253c9efb4d05afc56b381a7676e94c514 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 17 Oct 2026 01:37:34 +0000 Subject: [PATCH] Test the initialize entry adapter forms Co-Authored-By: Claude Opus 5.5 --- .../test_refinement_three_level_multipatch.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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)