Skip to content

validate order kwarg in BitArray.from_bool_array() #12673

@aeddins-ibm

Description

@aeddins-ibm

Environment

  • Qiskit version: 1.1

What is happening?

BitArray.from_bool_array() has a kwarg order which nominally should be 'little' or 'big' (for bit-ordering of the input array).

The function only checks whether or not order == 'little':

if order == "little":
# np.unpackbits assumes "big"
array = array[..., ::-1]

Would be helpful to raise an error if order is neither 'little' nor 'big'. Otherwise e.g. a user will unknowingly get the wrong result if they typo order = 'litle'.

How can we reproduce the issue?

see above

What should happen?

see above

Any suggestions?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmod: primitivesRelated to the Primitives module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions