From d7eb1e21f4a663aee579f0f3cf90a14dce17e209 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Fri, 2 Sep 2022 10:04:58 +0100 Subject: [PATCH] test fix --- src/textual/css/parse.py | 2 +- src/textual/css/stylesheet.py | 2 +- tests/css/test_stylesheet.py | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/textual/css/parse.py b/src/textual/css/parse.py index 284bd20d8..7ea876355 100644 --- a/src/textual/css/parse.py +++ b/src/textual/css/parse.py @@ -347,7 +347,7 @@ def parse( path (str): Path to the CSS variables (dict[str, str]): Substitution variables to substitute tokens for. is_default_rules (bool): True if the rules we're extracting are - default (i.e. in Widget.CSS) rules. False if they're from user defined CSS. + default (i.e. in Widget.DEFAULT_CSS) rules. False if they're from user defined CSS. """ variable_tokens = tokenize_values(variables or {}) tokens = iter(substitute_references(tokenize(css, path), variable_tokens)) diff --git a/src/textual/css/stylesheet.py b/src/textual/css/stylesheet.py index 6bba42357..d696525a8 100644 --- a/src/textual/css/stylesheet.py +++ b/src/textual/css/stylesheet.py @@ -209,7 +209,7 @@ class Stylesheet: css (str): String containing Textual CSS. path (str | PurePath): Path to CSS or unique identifier is_default_rules (bool): True if the rules we're extracting are - default (i.e. in Widget.CSS) rules. False if they're from user defined CSS. + default (i.e. in Widget.DEFAULT_CSS) rules. False if they're from user defined CSS. Raises: StylesheetError: If the CSS is invalid. diff --git a/tests/css/test_stylesheet.py b/tests/css/test_stylesheet.py index 7713a604b..be54fe936 100644 --- a/tests/css/test_stylesheet.py +++ b/tests/css/test_stylesheet.py @@ -112,10 +112,12 @@ def test_stylesheet_apply_user_css_over_widget_css(): node.add_class("a") stylesheet = _make_user_stylesheet(user_css) - stylesheet.add_source(MyWidget.CSS, "widget.py:MyWidget", is_default_css=True) + stylesheet.add_source( + MyWidget.DEFAULT_CSS, "widget.py:MyWidget", is_default_css=True + ) stylesheet.apply(node) - # The node is red because user CSS overrides Widget.CSS + # The node is red because user CSS overrides Widget.DEFAULT_CSS assert node.styles.color == Color(255, 0, 0) # The background colour defined in the Widget still applies, since user CSS doesn't override it assert node.styles.background == Color(0, 255, 0)