From 536302379d0c6fb64d5f31507f10aaa56a3200f6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 17 May 2026 11:01:38 +0000 Subject: [PATCH 1/2] Fix source-code loading example crash Co-authored-by: 0-coding <0-coding@users.noreply.github.com> --- source/load_mod_from_source_code.py | 2 +- tests/test_examples.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/test_examples.py diff --git a/source/load_mod_from_source_code.py b/source/load_mod_from_source_code.py index b2204a5..f108168 100644 --- a/source/load_mod_from_source_code.py +++ b/source/load_mod_from_source_code.py @@ -1,4 +1,4 @@ -sc = "a=b" +sc = "a='b'" my_name_space = {} exec(sc, my_name_space) print(my_name_space['a']) \ No newline at end of file diff --git a/tests/test_examples.py b/tests/test_examples.py new file mode 100644 index 0000000..582f40d --- /dev/null +++ b/tests/test_examples.py @@ -0,0 +1,23 @@ +import subprocess +import sys +import unittest +from pathlib import Path + + +class ExampleScriptsTestCase(unittest.TestCase): + def test_load_mod_from_source_code_runs_successfully(self): + script = Path(__file__).resolve().parents[1] / "source" / "load_mod_from_source_code.py" + + result = subprocess.run( + [sys.executable, str(script)], + check=True, + capture_output=True, + text=True, + ) + + self.assertEqual(result.stdout, "b\n") + self.assertEqual(result.stderr, "") + + +if __name__ == "__main__": + unittest.main() From acdad45b7f1228ac0f8549084a751fb09b13c74b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 17 May 2026 11:01:52 +0000 Subject: [PATCH 2/2] Enable unittest discovery for example tests Co-authored-by: 0-coding <0-coding@users.noreply.github.com> --- tests/__init__.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/__init__.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ +