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

test: ✅ Add unit tests for SpectraFit version and Python 3.8 deprecation warning #1641

Merged
merged 3 commits into from
Oct 14, 2024

Conversation

Anselmoo
Copy link
Owner

@Anselmoo Anselmoo commented Oct 14, 2024

All PR-Submissions:


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open
    Pull Requests for the same
    update/change?

New ✨✨ Feature-Submissions:


  • Does your submission pass tests?
  • Have you lint your code locally prior to submission? Fixed:
  • This PR is for a new feature, not a bug fix.

Changes to ⚙️ Core-Features:


  • Have you added an explanation of what your changes do and why you'd like
    us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

Summary by Sourcery

Tests:

  • Add unit tests for the SpectraFit version and ensure a deprecation warning is issued for Python 3.8, while no warning is issued for other Python versions.

@Anselmoo Anselmoo enabled auto-merge (squash) October 14, 2024 04:30
Copy link

semanticdiff-com bot commented Oct 14, 2024

Review changes with SemanticDiff.

Analyzed 3 of 3 files.

Overall, the semantic diff is 5% smaller than the GitHub diff.

Filename Status
✔️ spectrafit/__init__.py 41.09% smaller
✔️ spectrafit/test/test_init.py Analyzed
✔️ spectrafit/plugins/notebook.py 0.0% smaller

Copy link
Contributor

sourcery-ai bot commented Oct 14, 2024

Reviewer's Guide by Sourcery

This pull request adds unit tests for SpectraFit version and Python 3.8 deprecation warning, while also making minor improvements to code documentation and readability. The changes focus on enhancing the codebase's maintainability and preparing for future Python version support.

Class diagram for DataFramePlot class changes

classDiagram
    class DataFramePlot {
        +plot_2dataframes(args_plot: PlotAPI, df_1: pd.DataFrame, df_2: Optional[pd.DataFrame])
        +_plot_single_dataframe(args_plot: PlotAPI, df: pd.DataFrame) : Figure
        +_plot_two_dataframes(args_plot: PlotAPI, df_1: pd.DataFrame, df_2: pd.DataFrame) : Figure
        +plot_dataframe(args_plot: PlotAPI, df: pd.DataFrame)
        +plot_global_fit(args_plot: PlotAPI, df: pd.DataFrame)
        +plot_metric(args_plot: PlotAPI, df_metric: pd.DataFrame, bar_criteria: Union[str, List[str]], line_criteria: Union[str, List[str]])
        note for DataFramePlot "Updated docstrings to use 'dataframe' instead of 'data frame'"
    }
Loading

Class diagram for SpectraFit version and deprecation warning

classDiagram
    class SpectraFit {
        +PYTHON_38_VERSION : tuple
        +__version__ : str
        +test_version() : None
        +test_python_38_warning(monkeypatch: MonkeyPatch) : None
        +test_no_warning_for_other_versions(monkeypatch: MonkeyPatch) : None
        note for SpectraFit "Added unit tests for version and Python 3.8 deprecation warning"
    }
Loading

File-Level Changes

Change Details Files
Improved consistency and readability in documentation
  • Updated 'data frame' to 'dataframe' in docstrings and comments
  • Made minor grammatical improvements in docstrings
spectrafit/plugins/notebook.py
Enhanced Python 3.8 deprecation warning
  • Introduced PYTHON_38_VERSION constant
  • Improved warning message formatting
  • Made the warning message more dynamic by including the version number
spectrafit/__init__.py
Added unit tests for SpectraFit version and Python 3.8 deprecation warning
  • Created test_version function to check SpectraFit version
  • Implemented test_python_38_warning to verify deprecation warning for Python 3.8
  • Added test_no_warning_for_other_versions to ensure no warnings for other Python versions
spectrafit/test/test_init.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added testing Improve testing & coverage python Pull requests that update Python code release Release labels Oct 14, 2024
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Anselmoo - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (f5555e1) to head (de45332).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1641   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           44        45    +1     
  Lines         4492      4518   +26     
=========================================
+ Hits          4492      4518   +26     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
spectrafit/__init__.py 100.00% <100.00%> (ø)
spectrafit/plugins/notebook.py 100.00% <ø> (ø)
spectrafit/test/test_init.py 100.00% <100.00%> (ø)

@Anselmoo Anselmoo merged commit 1d67899 into main Oct 14, 2024
31 checks passed
@Anselmoo Anselmoo deleted the update-init-deprecation-warning branch October 14, 2024 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code release Release size/M testing Improve testing & coverage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant