Skip to content

Commit bdf6db8

Browse files
authored
feat(generators): widen DepartmentNameGenerator data, fix de/en mismatch (#192)
## Summary - Reported as a missing generator (\`DepartmentNameGenerator\`), but it already exists at \`datamimic_ce/domains/common/literal_generators/department_name_generator.py\` - registered automatically via \`auto_register_generators()\` (location + naming convention, no manual export needed). - The actual gap: a thin word list (no Engineering/Finance/Customer Support/Operations/R&D) and a de/en mismatch - the German list carried untranslated English words ("Accounting") and was missing a "Manufacturing" counterpart. - Widened both locale lists to the same 13 departments, properly translated for de. - Added the missing unit test (none existed - only incidental DSL coverage in \`test_large_count/test_generators.xml\` and the demo \`organization.xml\` that exercises generation without asserting on values). ## Test plan - [x] New unit test (\`test_department_name_generator_support_locale\`, \`test_department_name_generator_unsupported_locale_falls_back_to_en\`). - [x] Existing DSL fixture using the generator still passes. - [x] mypy/ruff clean.
1 parent aedb97e commit bdf6db8

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

datamimic_ce/domains/common/literal_generators/department_name_generator.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,28 @@ def __init__(self, locale: str | None = "en", rng: random.Random | None = None)
2222
"Manufacturing",
2323
"Logistics",
2424
"Legal",
25+
"Engineering",
26+
"Finance",
27+
"Customer Support",
28+
"Operations",
29+
"Research and Development",
2530
]
2631
sp_locale = ("de", "en")
2732
if locale == "de":
2833
self._department_data = [
29-
"Accounting",
34+
"Buchhaltung",
3035
"Human Resources",
3136
"Vertrieb",
3237
"Marketing",
3338
"IT",
39+
"Fertigung",
3440
"Logistik",
3541
"Recht",
42+
"Entwicklung",
43+
"Finanzen",
44+
"Kundensupport",
45+
"Betrieb",
46+
"Forschung und Entwicklung",
3647
]
3748
elif locale not in sp_locale:
3849
logger.info(f"Department name does not support locale '{locale}'. Change to department_en data")
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# DATAMIMIC
2+
# Copyright (c) 2023-2025 Rapiddweller Asia Co., Ltd.
3+
# This software is licensed under the MIT License.
4+
# See LICENSE file for the full text of the license.
5+
# For questions and support, contact: info@rapiddweller.com
6+
7+
8+
from datamimic_ce.domains.common.literal_generators.department_name_generator import DepartmentNameGenerator
9+
10+
11+
def test_department_name_generator_support_locale():
12+
support_locales = ("en", "de")
13+
for support_locale in support_locales:
14+
department = DepartmentNameGenerator(locale=support_locale).generate()
15+
assert isinstance(department, str)
16+
17+
18+
def test_department_name_generator_unsupported_locale_falls_back_to_en():
19+
department = DepartmentNameGenerator(locale="fr").generate()
20+
assert department in DepartmentNameGenerator(locale="en")._department_data

0 commit comments

Comments
 (0)