From d1c21fb3aa3b2705d5862b17247d29853d3c947a Mon Sep 17 00:00:00 2001 From: Adwait Date: Mon, 24 Jun 2024 00:27:09 +0530 Subject: [PATCH 1/6] bowtie run example for smoke test of basic referencing support --- bowtie/_smoke.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/bowtie/_smoke.py b/bowtie/_smoke.py index 56083a687..27d5fb427 100644 --- a/bowtie/_smoke.py +++ b/bowtie/_smoke.py @@ -203,8 +203,9 @@ def __rich_console__( ), ) + schema = case.syntax(ref_dialect) reason.add_row( - case.syntax(ref_dialect), + schema, JSON(json.dumps(registry)), instances, ) @@ -215,6 +216,40 @@ def __rich_console__( padding=2, ) epilog.add_row(panel) + + test = { + "description": "basic referencing support", + "schema": json.loads( + "".join( + segment.text + for segment in console.render(schema) + ), + ), + "registry": registry, + "tests": [ + {"description": "a test", "instance": 37, "valid": False}, + ], + } + epilog.add_row( + Table( + Column(""), + caption=dedent( + rf""" + + [blue]bowtie run -i {self.id} <(printf ' + {json.dumps(test)} + ') + + [/]""" + f"can be used to reproduce one of the " + f"referencing failures." + """ + """), + box=None, + min_width=111, + caption_justify="left", + ), + ) else: title = f"{prefix} [/][b green]work!" From b1ce79d6392d64e2c79bc0e9f85771b5a5e84b8e Mon Sep 17 00:00:00 2001 From: Adwait Date: Mon, 24 Jun 2024 00:27:39 +0530 Subject: [PATCH 2/6] remove whitespaces --- bowtie/_smoke.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bowtie/_smoke.py b/bowtie/_smoke.py index 27d5fb427..e010a4279 100644 --- a/bowtie/_smoke.py +++ b/bowtie/_smoke.py @@ -235,13 +235,13 @@ def __rich_console__( Column(""), caption=dedent( rf""" - + [blue]bowtie run -i {self.id} <(printf ' {json.dumps(test)} ') [/]""" - f"can be used to reproduce one of the " + f"can be used to reproduce one of the " f"referencing failures." """ """), From 0e7d4ac714886c311ea8bb2e8c8434b799b560d1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 23 Jun 2024 19:00:06 +0000 Subject: [PATCH 3/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- bowtie/_smoke.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bowtie/_smoke.py b/bowtie/_smoke.py index e010a4279..12424ca2f 100644 --- a/bowtie/_smoke.py +++ b/bowtie/_smoke.py @@ -220,11 +220,10 @@ def __rich_console__( test = { "description": "basic referencing support", "schema": json.loads( - "".join( - segment.text - for segment in console.render(schema) - ), - ), + "".join( + segment.text for segment in console.render(schema) + ), + ), "registry": registry, "tests": [ {"description": "a test", "instance": 37, "valid": False}, @@ -244,7 +243,8 @@ def __rich_console__( f"can be used to reproduce one of the " f"referencing failures." """ - """), + """ + ), box=None, min_width=111, caption_justify="left", From fc7fea71f461554afd7febd74d119bdf9af41ef1 Mon Sep 17 00:00:00 2001 From: Adwait Date: Mon, 24 Jun 2024 00:34:09 +0530 Subject: [PATCH 4/6] again fix ruff errors --- bowtie/_smoke.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bowtie/_smoke.py b/bowtie/_smoke.py index e010a4279..5a12ee40e 100644 --- a/bowtie/_smoke.py +++ b/bowtie/_smoke.py @@ -241,10 +241,11 @@ def __rich_console__( ') [/]""" - f"can be used to reproduce one of the " - f"referencing failures." + "can be used to reproduce one of the " + "referencing failures." """ - """), + """, + ), box=None, min_width=111, caption_justify="left", From 0bedc0e134266f75a5e830b3850058d422a3c693 Mon Sep 17 00:00:00 2001 From: Adwait Date: Mon, 24 Jun 2024 21:22:44 +0530 Subject: [PATCH 5/6] using case.schema and using already failed test data --- bowtie/_smoke.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/bowtie/_smoke.py b/bowtie/_smoke.py index f955dfea9..12eafc385 100644 --- a/bowtie/_smoke.py +++ b/bowtie/_smoke.py @@ -203,9 +203,8 @@ def __rich_console__( ), ) - schema = case.syntax(ref_dialect) reason.add_row( - schema, + case.syntax(ref_dialect), JSON(json.dumps(registry)), instances, ) @@ -218,16 +217,20 @@ def __rich_console__( epilog.add_row(panel) test = { - "description": "basic referencing support", - "schema": json.loads( - "".join( - segment.text for segment in console.render(schema) - ), - ), - "registry": registry, + "description": case.description, + "schema": case.schema, "tests": [ - {"description": "a test", "instance": 37, "valid": False}, + { + "description": test.description, + "instance": test.instance, + "valid": test.expected(), + "comment": test.comment, + } + for test in case.tests + if isinstance(test, Test) ], + "comment": case.comment, + "registry": registry, } epilog.add_row( Table( From 50febf3c0a7b11b768aac5ea655d39ee7f599b9d Mon Sep 17 00:00:00 2001 From: Adwait Date: Mon, 24 Jun 2024 21:25:07 +0530 Subject: [PATCH 6/6] remove extra line in caption --- bowtie/_smoke.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bowtie/_smoke.py b/bowtie/_smoke.py index 12eafc385..1e33e0c49 100644 --- a/bowtie/_smoke.py +++ b/bowtie/_smoke.py @@ -237,7 +237,6 @@ def __rich_console__( Column(""), caption=dedent( rf""" - [blue]bowtie run -i {self.id} <(printf ' {json.dumps(test)} ')