From 05700fbfff38f49d6ecf8fbc842975d05cb32415 Mon Sep 17 00:00:00 2001 From: BREW <81044362+b-re-w@users.noreply.github.com> Date: Sat, 3 Oct 2026 23:55:02 +0900 Subject: [PATCH] Test: Run against the binder that translates names itself, and pin that both rules agree python-multiplatform #131 (develop 452cc807) restores snake_case names and keywords in the binder, by this package's rule. Step 1 of handing that back: this suite against #131, unchanged, gives 251 passed and 1 failed. The failure is a test that assumed a binder without describe_member refuses a snake_case method keyword; the binder now accepts it itself, so the test skips there. A new test pins that the binder's python_name and this package's agree on names that test the rule (acronyms, overload suffixes, upper-case names); it skips on a binder that renames nothing. test added: TheBindersNamingRuleIsThisPackages (11 names). test changed: test_a_snake_case_keyword_is_the_binders_refusal skips on #131. Suite with python-multiplatform 452cc807 (#131), main checkout: 253 passed, 1 skipped. The older sibling checkout is also run. Refs #79 --- tests/test_chain.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_chain.py b/tests/test_chain.py index 723546c..a5902e5 100644 --- a/tests/test_chain.py +++ b/tests/test_chain.py @@ -301,12 +301,36 @@ def test_the_name_resolves_and_kotlin_keywords_work(self): self.assertEqual("padding__PaddingValues", self.host.calls[-1]) def test_a_snake_case_keyword_is_the_binders_refusal(self): + import python_multiplatform import pythonx.compose.foundation.layout as layout + if hasattr(python_multiplatform, "python_name"): + self.skipTest("the binder translates names itself since python-multiplatform #131") with self.assertRaises(TypeError): self.empty().padding(padding_values=layout.padding_values_of(8)) +class TheBindersNamingRuleIsThisPackages(AdapterCase): + """python-multiplatform #131 restored the binder's own snake_case names, with this package's rule. + + The two must not drift: a name the binder serves and a name this package's stubs and re-export + spell would otherwise differ. Skips on a binder that renames nothing. + """ + + NAMES = ("fillMaxWidth", "toURLString", "zIndex", "padding__Dp_Dp", "onClick", "Modifier", + "paddingValuesOf", "HTMLParser", "layoutDirection", "spacedBy", "x") + + def test_both_rules_agree(self): + import python_multiplatform + from pythonx.compose._reexport import python_name + + if not hasattr(python_multiplatform, "python_name"): + self.skipTest("this binder predates python-multiplatform #131") + for name in self.NAMES: + with self.subTest(name=name): + self.assertEqual(python_name(name), python_multiplatform.python_name(name)) + + class Names(AdapterCase): """PascalCase for types, snake_case for everything else, forward by rule and never inverted."""