You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix TypeError in SPI/UART tests and correct frequency calculation #270
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.
Rather than hardcoding static frequencies (which was previously rejected in #258), the root cause was resolved in pslab/bus/init.py's classmethod_ descriptor: in Python 3.11+, chaining classmethod on descriptors like @Property was deprecated and removed in Python 3.13, causing classmethod_ to return a bound method object instead of evaluating the property getter.
PR #287 updates classmethod_.get to properly evaluate the property descriptor across all Python versions on both classes and instances, corrects the PWM_FERQUENCY typo to PWM_FREQUENCY, and adds regression tests to verify that SPIMaster._frequency, SPIMaster._clock_phase, and UART._baudrate return their evaluated numeric values.
Activity
Fix: Use realistic static frequencies (100kHz/500kHz) with comments (F…
Shikhar-Kesharwani commentedon Sep 10, 2026
I have submitted #287 addressing this issue.
Rather than hardcoding static frequencies (which was previously rejected in #258), the root cause was resolved in pslab/bus/init.py's classmethod_ descriptor: in Python 3.11+, chaining classmethod on descriptors like @Property was deprecated and removed in Python 3.13, causing classmethod_ to return a bound method object instead of evaluating the property getter.
PR #287 updates classmethod_.get to properly evaluate the property descriptor across all Python versions on both classes and instances, corrects the PWM_FERQUENCY typo to PWM_FREQUENCY, and adds regression tests to verify that SPIMaster._frequency, SPIMaster._clock_phase, and UART._baudrate return their evaluated numeric values.