PERCENT double declaration

Open Beginner friendly
#1,250 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
60/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
testing-qa

Research direction

Openhtf/util/units.py around lines 3648–3651 contains the duplicate PERCENT declarations; start by reading that block. Rename the second descriptor as described so the percent and pct units remain accessible under distinct names, then verify both entries are present in ALL_UNITS.

Written by the indexing model from the issue text.

Description

Issue

In openhtf.units L3648C1-L3651C26, PERCENT is defined twice:

PERCENT = UnitDescriptor('percent', 'P1', '%')
ALL_UNITS.append(PERCENT)
PERCENT = UnitDescriptor('percent', 'P1', 'pct')
ALL_UNITS.append(PERCENT)

Because the second assignment overwrites the first, units.PERCENT always resolves to "pct", and the "%" unit is inaccessible.

Solution

Rename PERCENT "pct" --> PERCENT_PCT

Dominant language
Python
Stars
723
Forks
238
Avg merge
11h 31m
Merged PRs (30d)
4

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.

More from google/openhtf

All issues in google/openhtf

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.