ni / ni/nimi-python

Error in return type for most 'autorange' properties in nidcpower library

Open
#2,030 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API bug nidcpower
Dominant language
Python
Stars
128
Forks
110
Avg merge
5d 14h
Merged PRs (30d)
10

Description

Description of issue

In the code documentation, most of the "autorange"-related parameter are described as bool, which is wrong.
The correct type is int.

Steps to reproduce issue
``` python
import pytest

import nidcpower

@pytest.fixture
def smu() -> nidcpower.Session:
    return nidcpower.Session(
        resource_name="PXI1Slot2",
        channels=None,
        reset=True,
        options={'range_check': True,
                 'simulate': True,
                 'driver_setup': {'Model': '4163', 'BoardType': 'PXIe'}},
        independent_channels=True)

def test_wrong_type(smu):

    assert isinstance(smu.autorange, bool)

def test_correct_type(smu):

    assert isinstance(smu.autorange, int)
```
  1. Run pytest on the above script.
  2. The first test fails because an AssertiorError is raised.
  3. The second test passes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the nidcpower API documentation linked in the issue and inspect the autorange-related parameters, then run the provided pytest reproduction against a simulated nidcpower.Session. Done means the affected autorange properties are documented with the correct int return type and the reproduction still passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.