Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more tests for API generation script #581

Merged
merged 3 commits into from
Jan 5, 2024
Merged

Conversation

Eric-Arellano
Copy link
Collaborator

Part of #223.

One way to improve the maintainability of our API generation is to test more. It gives us confidence we aren't breaking things and it makes it more obvious how the function behaves.

This PR also makes some light refactoring like renaming things to be more clear.

versionWithoutPatch: "0.0",
hasSeparateReleaseNotes: true,
title: "My Quantum Software Project",
} as Pkg;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an important trick to make tests more readable, rather than us having to give dummy values for attributes that aren't relevant. We should audit existing tests to use this when possible.

Comment on lines +45 to +47
const descriptionSuffix = pkg.hasSeparateReleaseNotes
? `in ${pkg.title}${versionStr}`
: `to ${pkg.title}`;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a behavior change for Qiskit, but same for Runtime and Provider.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use to for both cases?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The English reads poorly to say "Changes made to Qiskit 0.45" because it sounds like you're only changing Qiskit 0.45, when in reality you are changing Qiskit 0.45+. It's not wrong, but makes less sense.

(Prepositions are the worst part of languages for me lol)


describe("dedupeIds", () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same test, I only removed the unnecessary describe().

Copy link
Collaborator

@arnaucasau arnaucasau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Thank you for adding all these tests, it will help a lot ensuring that everything works as intended and understanding some parts of the code better. I added a new test in addFrontMatter.test.ts to verify the order of the conditionals if we have python_api_name defined and also hardcoded_frontmatter. I think this will be useful for #66.

I left a couple of comments, but I approve the PR for when you think it's ready to merge, all worked well on my end!

Comment on lines +45 to +47
const descriptionSuffix = pkg.hasSeparateReleaseNotes
? `in ${pkg.title}${versionStr}`
: `to ${pkg.title}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use to for both cases?

scripts/lib/sphinx/flattenFolders.test.ts Outdated Show resolved Hide resolved
scripts/lib/sphinx/specialCaseResults.test.ts Outdated Show resolved Hide resolved
Co-authored-by: Arnau Casau <[email protected]>
@Eric-Arellano Eric-Arellano added this pull request to the merge queue Jan 5, 2024
Merged via the queue into main with commit 704fe05 Jan 5, 2024
4 checks passed
@Eric-Arellano Eric-Arellano deleted the EA/add-tests branch January 5, 2024 18:13
github-actions bot pushed a commit that referenced this pull request Jan 9, 2024
Part of #223. 

One way to improve the maintainability of our API generation is to test
more. It gives us confidence we aren't breaking things and it makes it
more obvious how the function behaves.

This PR also makes some light refactoring like renaming things to be
more clear.

---------

Co-authored-by: Arnau Casau <[email protected]>
Co-authored-by: Arnau Casau <[email protected]>
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
Part of Qiskit#223. 

One way to improve the maintainability of our API generation is to test
more. It gives us confidence we aren't breaking things and it makes it
more obvious how the function behaves.

This PR also makes some light refactoring like renaming things to be
more clear.

---------

Co-authored-by: Arnau Casau <[email protected]>
Co-authored-by: Arnau Casau <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants