Skip to content

Modify function to append dummy clear value if not provided #1231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jamiebenstead
Copy link
Contributor

@jamiebenstead jamiebenstead commented Jul 16, 2025

closes https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/610

Tested using -

_ish.colourRead = lambda: [100, 150, 200, 128]

sh = SenseHat()

# TEST 1: Full colour tuple
rgba = sh.colour.colour
assert isinstance(rgba, tuple), "colour should return a tuple"
assert len(rgba) == 4, "colour should return a 4-tuple (R, G, B, Clear)"
assert rgba == (100, 150, 200, 128), f"Unexpected colour values: {rgba}"

# TEST 2: Individual colour components
assert sh.colour.red == 100, f"Red value incorrect: {sh.colour.red}"
assert sh.colour.green == 150, f"Green value incorrect: {sh.colour.green}"
assert sh.colour.blue == 200, f"Blue value incorrect: {sh.colour.blue}"
assert sh.colour.clear == 128, f"Clear value incorrect: {sh.colour.clear}"

# TEST 3: Aliases
assert sh.colour.color == sh.colour.colour, "color alias not matching colour"
assert sh.colour.color_raw == sh.colour.colour_raw, "color_raw alias not matching colour_raw"

# TEST 4: Raw colour data
raw = sh.colour.colour_raw
assert isinstance(raw, tuple), "colour_raw should return a tuple"
assert raw == (100, 150, 200, 128), f"Unexpected raw values: {raw}"

print("✅ All tests passed successfully!")

@jamiebenstead jamiebenstead temporarily deployed to previews/1231/merge July 16, 2025 17:19 — with GitHub Actions Inactive
@jamiebenstead jamiebenstead temporarily deployed to previews/1231/merge July 16, 2025 17:23 — with GitHub Actions Inactive
Copy link
Contributor

@loiswells97 loiswells97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants