diff options
| author | Louis Burda <dev@sinitax.com> | 2026-02-28 18:54:19 +0100 |
|---|---|---|
| committer | Louis Burda <dev@sinitax.com> | 2026-02-28 18:54:19 +0100 |
| commit | be1dd21f8e4fbd5361531b4d8727a0d0d243e8ec (patch) | |
| tree | e7b540012e0510d1304d2dac8e137545ae103f75 /examples | |
| parent | d70a199a72bf9a69eb4a3fcf166b0435918b2e33 (diff) | |
| download | selectui-main.tar.gz selectui-main.zip | |
Diffstat (limited to 'examples')
| -rwxr-xr-x | examples/json_conversion.py | 6 | ||||
| -rwxr-xr-x | examples/library_usage.py | 2 | ||||
| -rwxr-xr-x | examples/minimal.py | 2 | ||||
| -rwxr-xr-x | examples/pydantic_example.py | 4 | ||||
| -rwxr-xr-x | examples/simple_library_example.py | 3 | ||||
| -rw-r--r-- | examples/test_library.py | 9 | ||||
| -rwxr-xr-x | examples/test_pydantic.py | 8 |
7 files changed, 17 insertions, 17 deletions
diff --git a/examples/json_conversion.py b/examples/json_conversion.py index 7cdeec0..5e502fb 100755 --- a/examples/json_conversion.py +++ b/examples/json_conversion.py @@ -6,13 +6,13 @@ Demonstrates how to load JSON data and convert it to SelectItem instances with configurable field mappings. """ -import sys -import os import json +import os +import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src')) -from selectui import SelectUI, SelectItem +from selectui import SelectItem, SelectUI def load_json_as_selectitems(json_path, title_key, subtitle_key=None, info_key=None): diff --git a/examples/library_usage.py b/examples/library_usage.py index e0024a9..fa77a19 100755 --- a/examples/library_usage.py +++ b/examples/library_usage.py @@ -6,7 +6,7 @@ This shows various ways to integrate SelectUI into your Python applications. """ import sys -import os + from selectui import SelectUI diff --git a/examples/minimal.py b/examples/minimal.py index c79d632..b7e02e2 100755 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -3,8 +3,8 @@ Minimal example of using selectui as a library. """ -import sys import os +import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src')) diff --git a/examples/pydantic_example.py b/examples/pydantic_example.py index 3c80dcb..85d9132 100755 --- a/examples/pydantic_example.py +++ b/examples/pydantic_example.py @@ -5,12 +5,12 @@ Example demonstrating SelectUI with Pydantic models. This shows how to use SelectItem for type safety and validation. """ -import sys import os +import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src')) -from selectui import SelectUI, SelectItem +from selectui import SelectItem, SelectUI def example_basic_pydantic(): diff --git a/examples/simple_library_example.py b/examples/simple_library_example.py index ac4a46b..5a6a6a3 100755 --- a/examples/simple_library_example.py +++ b/examples/simple_library_example.py @@ -3,8 +3,8 @@ Simple example showing how to use selectui as a library. """ -import sys import os +import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src')) @@ -83,7 +83,6 @@ def select_from_simple_list(): def select_file(): """Select a file from current directory.""" import os - import json files = [] for filename in os.listdir('.'): diff --git a/examples/test_library.py b/examples/test_library.py index dfcbaed..a8daffc 100644 --- a/examples/test_library.py +++ b/examples/test_library.py @@ -4,13 +4,14 @@ Test script to verify SelectUI works as a library. This doesn't require user interaction - just checks that the API works. """ -import sys import os +import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src')) from selectui import SelectUI + def test_initialization(): """Test that SelectUI can be initialized with items.""" items = [ @@ -26,7 +27,7 @@ def test_initialization(): ) assert app.items == items - assert app.oneshot == True + assert app.oneshot assert app.title_key == "title" assert app.subtitle_key == "subtitle" assert app.selected_item is None @@ -73,7 +74,7 @@ def test_events_mode(): events_mode=True ) - assert app.events_mode == True + assert app.events_mode print("✓ Events mode test passed") @@ -85,7 +86,7 @@ def test_command_template(): ) assert app.command_template == "echo {}" - assert app.input_mode == True + assert app.input_mode print("✓ Command template test passed") diff --git a/examples/test_pydantic.py b/examples/test_pydantic.py index a1c7f44..ee0d493 100755 --- a/examples/test_pydantic.py +++ b/examples/test_pydantic.py @@ -3,12 +3,12 @@ Tests for Pydantic SelectItem model and JSON conversion. """ -import sys import os +import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src')) -from selectui import SelectUI, SelectItem +from selectui import SelectItem, SelectUI def test_selectitem_creation(): @@ -42,14 +42,14 @@ def test_selectitem_validation(): """Test SelectItem validation.""" # Empty title should fail try: - item = SelectItem(title="") + SelectItem(title="") assert False, "Should have raised validation error for empty title" except Exception: print("✓ Empty title validation test passed") # Whitespace-only title should fail try: - item = SelectItem(title=" ") + SelectItem(title=" ") assert False, "Should have raised validation error for whitespace title" except Exception: print("✓ Whitespace title validation test passed") |
