From 2f75a9076c567690f2a6a647ec07cfa9e558ff9c Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Wed, 20 Mar 2024 15:19:05 -0500 Subject: [PATCH] Add tests for shiny_mode comment detection --- tests/pytest/test_express.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/pytest/test_express.py b/tests/pytest/test_express.py index b2e01bc22..57823ee07 100644 --- a/tests/pytest/test_express.py +++ b/tests/pytest/test_express.py @@ -44,3 +44,10 @@ def write_tmp_file(s: str): write_tmp_file("def f():\n import shiny.express") assert not express.is_express_app(tmp_file, None) + + # Look for magic comment - should override import detection + write_tmp_file("\n#shiny_mode: core\nfrom shiny.express import ui") + assert not express.is_express_app(tmp_file, None) + + write_tmp_file("#shiny_mode: express\nfrom shiny import ui") + assert express.is_express_app(tmp_file, None)