Skip to content

Comments

chore: deprecate getLastAtom and add a test#159

Merged
sbillinge merged 1 commit intodiffpy:v3.4.0from
stevenhua0320:deprecate-getLastAtom
Feb 20, 2026
Merged

chore: deprecate getLastAtom and add a test#159
sbillinge merged 1 commit intodiffpy:v3.4.0from
stevenhua0320:deprecate-getLastAtom

Conversation

@stevenhua0320
Copy link
Contributor

@sbillinge ready to review, note that there is no test for getLastAtom, but it is only a getter function, I add a very simple function to test this. Now the pytest would be shown like this:

(diffpy.structure) ~/dbs/diffpy.structure git:[deprecate-getLastAtom]
pytest
============================================================================================================== test session starts ==============================================================================================================
platform darwin -- Python 3.14.3, pytest-9.0.2, pluggy-1.6.0
rootdir: /Users/huarundong/dbs/diffpy.structure
configfile: pyproject.toml
collected 143 items                                                                                                                                                                                                                             

tests/test_atom.py ..                                                                                                                                                                                                                     [  1%]
tests/test_lattice.py ............                                                                                                                                                                                                        [  9%]
tests/test_loadstructure.py ......                                                                                                                                                                                                        [ 13%]
tests/test_p_cif.py .....................                                                                                                                                                                                                 [ 28%]
tests/test_p_discus.py .....                                                                                                                                                                                                              [ 32%]
tests/test_p_pdffit.py .........                                                                                                                                                                                                          [ 38%]
tests/test_parsers.py .............                                                                                                                                                                                                       [ 47%]
tests/test_spacegroups.py .....                                                                                                                                                                                                           [ 51%]
tests/test_structure.py .............................................                                                                                                                                                                     [ 82%]
tests/test_supercell.py ...                                                                                                                                                                                                               [ 84%]
tests/test_symmetryutilities.py .....................                                                                                                                                                                                     [ 99%]
tests/test_version.py .                                                                                                                                                                                                                   [100%]

=============================================================================================================== warnings summary ================================================================================================================
tests/test_structure.py::TestStructure::test_addNewAtom
  /Users/huarundong/dbs/diffpy.structure/tests/test_structure.py:149: DeprecationWarning: 'diffpy.structure.Structure.addNewAtom' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.structure.Structure.add_new_atom' instead.
    structure.addNewAtom(atype="C", xyz=[0.1, 0.2, 0.3])

tests/test_structure.py::TestStructure::test_getLastAtom
  /Users/huarundong/dbs/diffpy.structure/tests/test_structure.py:127: DeprecationWarning: 'diffpy.structure.Structure.getLastAtom' is deprecated and will be removed in version 4.0.0. Please use 'diffpy.structure.Structure.get_last_atom' instead.
    actual = structure.getLastAtom()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================================== 143 passed, 2 warnings in 2.91s ========================================================================================================

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.95%. Comparing base (52c99e6) to head (793f5b0).
⚠️ Report is 3 commits behind head on v3.4.0.

Additional details and impacted files
@@           Coverage Diff           @@
##           v3.4.0     #159   +/-   ##
=======================================
  Coverage   98.95%   98.95%           
=======================================
  Files          13       13           
  Lines        1905     1919   +14     
=======================================
+ Hits         1885     1899   +14     
  Misses         20       20           
Files with missing lines Coverage Δ
tests/test_structure.py 99.79% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbillinge
Copy link
Contributor

This is perfect! Well, one thought, I am not sure why we are using build: as our prefix on the title. This has nothing to do with building the package. I think perhaps chore: might be better? But it is a small thing.

Now things are going smoothly, I think that it is ok to put more than one of these on each PR if that is easier. But please, not more than 3 or 4 as they become confusing to review.

Thanks so much for this @stevenhua0320

@sbillinge sbillinge merged commit 0762314 into diffpy:v3.4.0 Feb 20, 2026
6 checks passed
@stevenhua0320 stevenhua0320 changed the title build: deprecate getLastAtom and add a test chore: deprecate getLastAtom and add a test Feb 20, 2026
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