ni / nidaqmx-python

A Python API for interacting with NI-DAQmx
Other
440 stars 154 forks source link

fix physical channel/device collection slice/string behavior #536

Closed zhindes closed 6 months ago

zhindes commented 7 months ago

What does this Pull Request accomplish?

Fixes string and slice behavior of Physical Channel Collection to match that of Device Collection

~New behavior~

Why should this Pull Request be merged?

Closes #392

What testing has been done?

Added new tests. Fixed existing tests that used the name of an invalid PhysicalChannel object to use the channel_names property of the collection instead.

poetry run ni-python-styleguide fix tests && poetry run ni-python-styleguide lint tests && poetry run pytest -rs -k collection
================================================= test session starts =================================================
platform win32 -- Python 3.9.13, pytest-8.0.2, pluggy-1.4.0
rootdir: C:\dev\nidaqmx-python
configfile: pyproject.toml
testpaths: tests
plugins: cov-4.1.0, mock-3.12.0
collected 2163 items / 1721 deselected / 442 selected

tests\component\system\_collections\test_device_collection.py ....................                               [  4%]
tests\component\system\_collections\test_persisted_channel_collection.py ....................                    [  9%]
tests\component\system\_collections\test_persisted_scale_collection.py ....................                      [ 13%]
tests\component\system\_collections\test_persisted_task_collection.py ....................                       [ 18%]
tests\component\system\_collections\test_physical_channel_collection.py ........................................ [ 27%]
................................................................................................................ [ 52%]
................................................................................................................ [ 77%]
........................................................................................                         [ 97%]
tests\legacy\test_system_collections.py ..........                                                               [100%]

======================================== 442 passed, 1721 deselected in 11.99s ========================================
github-actions[bot] commented 7 months ago

Test Results

    34 files  ±    0      34 suites  ±0   43m 15s :stopwatch: + 1m 8s  2 228 tests +  160   1 893 :white_check_mark: +  192    335 :zzz:  -  32  0 :x: ±0  39 392 runs  +2 720  33 866 :white_check_mark: +3 264  5 526 :zzz:  - 544  0 :x: ±0 

Results for commit a9a8a797. ± Comparison against base commit 2e0e590c.

This pull request removes 32 and adds 192 tests. Note that renamed tests count towards both. ``` tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_str___shared_interpreter[grpc_init_kwargs-ai_physical_chans] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_str___shared_interpreter[grpc_init_kwargs-ao_physical_chans] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_str___shared_interpreter[grpc_init_kwargs-ci_physical_chans] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_str___shared_interpreter[grpc_init_kwargs-co_physical_chans] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_str___shared_interpreter[grpc_init_kwargs-di_lines] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_str___shared_interpreter[grpc_init_kwargs-di_ports] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_str___shared_interpreter[grpc_init_kwargs-do_lines] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_str___shared_interpreter[grpc_init_kwargs-do_ports] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_str___shared_interpreter[library_init_kwargs-ai_physical_chans] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_str___shared_interpreter[library_init_kwargs-ao_physical_chans] … ``` ``` tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_mixed_str_list___name[grpc_init_kwargs-ai_physical_chans] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_mixed_str_list___name[grpc_init_kwargs-ao_physical_chans] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_mixed_str_list___name[grpc_init_kwargs-ci_physical_chans] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_mixed_str_list___name[grpc_init_kwargs-co_physical_chans] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_mixed_str_list___name[grpc_init_kwargs-di_lines] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_mixed_str_list___name[grpc_init_kwargs-di_ports] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_mixed_str_list___name[grpc_init_kwargs-do_lines] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_mixed_str_list___name[grpc_init_kwargs-do_ports] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_mixed_str_list___name[library_init_kwargs-ai_physical_chans] tests.component.system._collections.test_physical_channel_collection ‑ test___physical_channels___getitem_mixed_str_list___name[library_init_kwargs-ao_physical_chans] … ```

:recycle: This comment has been updated with latest results.