Skip to content

Simplify translating local variable definitions in C tests to Python#254

Merged
avalentino merged 1 commit into
liberfa:mainfrom
eerovaher:TestFunction-process_definitions
May 22, 2026
Merged

Simplify translating local variable definitions in C tests to Python#254
avalentino merged 1 commit into
liberfa:mainfrom
eerovaher:TestFunction-process_definitions

Conversation

@eerovaher
Copy link
Copy Markdown
Contributor

The TestFunction class in erfa_generator is responsible for translating a C file with ERFA tests into a test suite for pytest. The code responsible for translating local variable definitions to Python is now shorter. There are a few differences between the erfa/tests/test_ufunc.py generated by current main branch and this PR:

550c550
<     b = np.empty(3, erfa_ufunc.dt_eraLDBODY).view(np.recarray)
---
>     b = np.empty((3,), erfa_ufunc.dt_eraLDBODY).view(np.recarray)
652c652
<     b = np.empty(3, erfa_ufunc.dt_eraLDBODY).view(np.recarray)
---
>     b = np.empty((3,), erfa_ufunc.dt_eraLDBODY).view(np.recarray)
1897c1897
<     b = np.empty(3, erfa_ufunc.dt_eraLDBODY).view(np.recarray)
---
>     b = np.empty((3,), erfa_ufunc.dt_eraLDBODY).view(np.recarray)

But these differences are not important because np.empty() interprets both the integer 3 and the single element tuple (3,) to mean the same shape.

The `TestFunction` class in `erfa_generator` is responsible for
translating a C file with ERFA tests into a test suite for `pytest`. The
code responsible for translating local variable definitions to Python is
now shorter.
@avalentino avalentino merged commit 0c336a0 into liberfa:main May 22, 2026
28 checks passed
@eerovaher eerovaher deleted the TestFunction-process_definitions branch May 22, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants