Skip to content

Conversation

@SandeepTuniki
Copy link
Contributor

@SandeepTuniki SandeepTuniki commented Jan 14, 2026

This PR fixes flakiness of the us_bls/cpi tests (observed in #1835) and improves the maintainability.

Main Change:

  • Updated tests to compare DataFrame values numerically rather than as strict strings. This fixes flakiness where valid formatting changes (e.g., 22.00 vs 22.0) caused false negatives.

Additionally, I made the following improvements:

  • Decoupled test methods so each series (cpi_u, cpi_w, c_cpi_u) is tested independently.
  • Switched to using temporary files for generated output to ensure tests don't leave artifacts in the file system. And consequently removed the output_dir since we no longer need to store them.
  • Standardized file and folder names of test data to keep it consistent.

- Update tests to compare numeric values instead of strings to handle trailing zero differences introduced by numeric conversion.
- Refactor test suite to be more modular and explicit (one test method per file).
- Rename 'actual_output' directory to 'expected_output' for clarity.
- Rename expected output files to match input filenames (remove '_output' suffix).
- Use temporary directories for test output to prevent filesystem pollution.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @SandeepTuniki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the reliability and maintainability of the US BLS CPI data generation tests. It addresses previous flakiness issues by ensuring that DataFrame comparisons are robust to minor formatting differences in numerical values. Furthermore, the test suite has been restructured for better modularity and cleanliness, utilizing temporary resources to prevent test-related clutter.

Highlights

  • Flakiness Fix: Resolved test flakiness in US BLS CPI data generation by updating DataFrame comparisons to use numerical values instead of strict string matching, preventing false negatives due to minor formatting differences.
  • Test Refactoring: Refactored the test suite to decouple test methods, with each CPI series (cpi_u, cpi_w, c_cpi_u) now tested independently for improved clarity and maintainability.
  • Temporary Output Files: Switched to using temporary directories for generated test output, ensuring that tests do not leave artifacts in the file system and simplifying test cleanup.
  • Standardized Test Data: Standardized the naming conventions for test data files and folders, enhancing consistency across the test environment.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively resolves the flakiness issues in the US BLS CPI generation tests by correctly handling DataFrame comparisons numerically. The refactoring into separate, isolated test methods using temporary directories for output significantly enhances test maintainability and reliability. The changes also standardize test data naming, contributing to a cleaner test suite.

@SandeepTuniki SandeepTuniki requested a review from ajaits January 14, 2026 16:53
@SandeepTuniki SandeepTuniki changed the title fix: Fix and refactor US BLS CPI generation tests fix(tests): Fix and refactor US BLS CPI generation tests Jan 14, 2026
@SandeepTuniki SandeepTuniki merged commit 122b63a into master Jan 14, 2026
9 checks passed
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