Closed Bug 1415555 Opened 7 years ago Closed 7 years ago

tests/migrate/test_plural.py could be more instructive

Categories

(Localization Infrastructure and Tools :: Fluent Migration, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: Pike, Unassigned)

Details

I found test_plural.py hard to grok, and here are a few things why: The test names talk about plural and plural and plural, it's hard to tell one apart from the other. I also found it hard to read test classes that have a setup method and just a single test. Suggestions: Create static assets for transforms and references once at the top of the module. Drop compare-locales dependency, just create plain dicts. Never set self.plural_categories in a test, or in all test methods. Some test runners allow to randomize test order, and then all hell breaks loose. With the static assets, the setup methods might go away completely. That might make some room for a more matrix-y testing and naming: - one, two, four plural forms - replace or not and test mismatch counts in source and plural forms. Are there more avenues?
Thanks for taking time to suggest these changes. I agree that the current structure of test_plural doesn't help to understand it. I think the main reason is that the test classes subclass MockContext and define the transform in setUp whereas really we should do it the other way around: the transform is invariant while we need a different configuration of MockContext for each test.
We've done most of this by now, resolving WORKSFORME. Also moving to the right bug component.
Status: NEW → RESOLVED
Closed: 7 years ago
Component: Python Library → Fluent Migration
Product: L20n → Localization Infrastructure and Tools
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.