diff --git a/pigment/__init__.py b/pigment/__init__.py index ef13882..cb1153e 100644 --- a/pigment/__init__.py +++ b/pigment/__init__.py @@ -55,6 +55,9 @@ class Color: def __init__(self, red: int, green: int, blue: int): self.rgb = (red, green, blue) + def __repr__(self): + return "" % self.rgb + def __eq__(self, other): if isinstance(other, Color): return self.rgb == other.rgb diff --git a/tests/test_repr.py b/tests/test_repr.py new file mode 100644 index 0000000..78fda3e --- /dev/null +++ b/tests/test_repr.py @@ -0,0 +1,14 @@ +from pytest import mark + +from pigment import Color + + +@mark.parametrize( + "color,expected", + [ + (Color(0, 0, 0), ""), + (Color(255, 255, 255), ""), + ], +) +def test_repr(color, expected): + assert repr(color) == expected