Fix TypeError in SPI/UART tests and correct frequency calculation

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

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with tests/test_spi.py and tests/test_uart.py, checking the PWM_FERQUENCY typo and the arithmetic using SPIMaster._frequency and UART._baudrate. Correct the constant and ensure the methods are called rather than using method objects, without hardcoding 1000. Run both test files and confirm the frequency calculations pass.

Written by the indexing model from the issue text.

Description

Description The current tests in tests/test_spi.py and tests/test_uart.py have two issues:

A typo in the constant name PWM_FERQUENCY.

A TypeError caused by attempting to perform arithmetic operations directly on the SPIMaster._frequency and UART._baudrate methods without calling them.

Proposed Solution

Rename the constant to PWM_FREQUENCY.

Fix the logic to correctly call the methods (e.g., SPIMaster._frequency()) to retrieve the integer value instead of using the method object itself.

Avoid hardcoding the frequency to 1000 to ensure tests remain meaningful.

Dominant language
Python
Stars
1.6k
Forks
242
PR merge metrics
No merged PRs in 30d

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 fossasia/pslab-python

All issues in fossasia/pslab-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.