Issue #7554: Various fixups in test_cmath.py: remove code duplication,