diff --git a/gt_extras/colors.py b/gt_extras/colors.py
index ffab65a..3f9c840 100644
--- a/gt_extras/colors.py
+++ b/gt_extras/colors.py
@@ -109,8 +109,8 @@ def gt_highlight_cols(
def gt_hulk_col_numeric(
gt: GT,
columns: SelectExpr = None,
- palette: str | list[str] | None = "PRGn",
- domain: list[str] | list[int] | list[float] | None = None,
+ palette: str | list[str] = "PRGn",
+ domain: list[int] | list[float] | None = None,
na_color: str | None = None,
alpha: int | float | None = None, # TODO: see note
reverse: bool = False,
diff --git a/gt_extras/html.py b/gt_extras/html.py
index 91b3de5..8c198dc 100644
--- a/gt_extras/html.py
+++ b/gt_extras/html.py
@@ -38,8 +38,8 @@ def gt_hyperlink(text: str, url: str, new_tab: bool = True) -> int:
def with_tooltip(
label: str,
tooltip: str,
- text_decoration_style: Literal["solid", "dotted"] | None = "dotted",
- color: str | None = "blue",
+ text_decoration_style: Literal["solid", "dotted", "none"] = "dotted",
+ color: str | Literal["none"] = "blue",
) -> str:
"""
Create HTML text with tooltip functionality for use in GT table cells.
@@ -58,11 +58,10 @@ def with_tooltip(
text_decoration_style
A string indicating the style of underline decoration. Options are `"solid"`,
- `"dotted"`, or `None`. If nothing is provided, then `"dotted"` will be used as a default.
+ `"dotted"`, or "none".
color
- A string indicating the text color. If `None`, no color styling is applied.
- If nothing is provided, then `"blue"` will be used as a default.
+ A string indicating the text color. If "none", no color styling is applied.
Returns
-------
@@ -71,18 +70,21 @@ def with_tooltip(
"""
# Throw if `text_decoration_style` is not one of the allowed values
- if text_decoration_style not in [None, "solid", "dotted"]:
- raise ValueError("Text_decoration_style must be one of `None`, 'solid', or 'dotted'")
+ if text_decoration_style not in ["none", "solid", "dotted"]:
+ raise ValueError("Text_decoration_style must be one of 'none', 'solid', or 'dotted'")
+
+ if color is None:
+ raise ValueError("color must be a string or 'none', not None.")
style = "cursor: help; "
- if text_decoration_style is not None:
+ if text_decoration_style != "none":
style += "text-decoration: underline; "
style += f"text-decoration-style: {text_decoration_style}; "
else:
style += "text-decoration: none; "
- if color is not None:
+ if color != "none":
style += f"color: {color}; "
return f'{label}'
diff --git a/gt_extras/icons.py b/gt_extras/icons.py
index 0023b5b..7e4b30f 100644
--- a/gt_extras/icons.py
+++ b/gt_extras/icons.py
@@ -14,18 +14,18 @@
def fa_icon_repeat(
name: str = "star",
repeats: int = 1,
- fill: str | None = "black",
- fill_opacity: int | str | None = 1,
+ fill: str = "black",
+ fill_opacity: int | str = 1,
stroke: str | None = None,
stroke_width: str | None = None,
stroke_opacity: int | str | None = None,
height: str | None = None,
width: str | None = None,
- margin_left: str | None = "auto",
- margin_right: str | None = "0.2em",
- position: str | None = "relative",
+ margin_left: str = "auto",
+ margin_right: str = "0.2em",
+ position: str = "relative",
title: str | None = None,
- a11y: Literal["deco", "sem"] | None = "deco",
+ a11y: Literal["deco", "sem", "none"] = "deco",
) -> str:
"""
Create repeated FontAwesome SVG icons as HTML.
@@ -75,7 +75,8 @@ def fa_icon_repeat(
The title (tooltip) for the icon.
a11y
- Accessibility mode: `"deco"` for decorative, `"sem"` for semantic.
+ Accessibility mode: `"deco"` for decorative, `"sem"` for semantic, `"none"` will result in
+ no accessibility features.
Returns
-------
diff --git a/gt_extras/plotting.py b/gt_extras/plotting.py
index f2b6f07..4b5e80e 100644
--- a/gt_extras/plotting.py
+++ b/gt_extras/plotting.py
@@ -34,7 +34,7 @@
def gt_plt_bar(
gt: GT,
- columns: SelectExpr | None = None,
+ columns: SelectExpr = None,
fill: str = "purple",
bar_height: int = 20,
height: int = 30,
diff --git a/gt_extras/tests/test_html.py b/gt_extras/tests/test_html.py
index 1507ca7..ed6faaa 100644
--- a/gt_extras/tests/test_html.py
+++ b/gt_extras/tests/test_html.py
@@ -67,18 +67,29 @@ def test_with_tooltip_underline_fail():
with_tooltip("1", "Number One", text_decoration_style="underline")
-def test_with_tooltip_no_decoration():
- result = with_tooltip("1", "Number One", text_decoration_style=None)
+def test_with_tooltip_None_color_fail():
+ with pytest.raises(ValueError):
+ with_tooltip("1", "Number One", color=None)
+
+
+def test_with_tooltip_underline_style_none():
+ result = with_tooltip("1", "Number One", text_decoration_style="none")
expected = '1'
assert result == expected
-def test_with_tooltip_no_color():
- result = with_tooltip("1", "Number One", color=None)
+def test_with_tooltip_color_none_pass():
+ result = with_tooltip("1", "Number One", color="none")
expected = '1'
assert result == expected
+def test_with_tooltip_custom_color():
+ result = with_tooltip("1", "Number One", color="red")
+ expected = '1'
+ assert result == expected
+
+
def test_with_tooltip_in_table():
df = pd.DataFrame(
{
diff --git a/gt_extras/tests/test_themes.py b/gt_extras/tests/test_themes.py
index 6a1d05b..3d78fac 100644
--- a/gt_extras/tests/test_themes.py
+++ b/gt_extras/tests/test_themes.py
@@ -73,7 +73,6 @@ def test_theme_pff_fonts_snap(snapshot, mini_gt):
def test_theme_pff_dividers(mini_gt):
themed_gt = gt_theme_pff(gt=mini_gt, divider="num")
html = themed_gt.as_raw_html()
- print(html)
assert "border-left: 2px solid lightgrey" in html