cmd [1] | fd -e py -x pyupgrade --keep-runtime-typing --py310-plus
cmd [2] | ruff format .
32 files left unchanged
cmd [3] | ruff check --fix --unsafe-fixes .
src/midjargon/cli/main.py:39:33: FBT001 Boolean-typed positional argument in function definition
   |
37 |     """CLI interface for midjargon."""
38 |
39 |     def json(self, prompt: str, no_color: bool = False) -> None:
   |                                 ^^^^^^^^ FBT001
40 |         """Parse a prompt to MidjargonDict format.
   |

src/midjargon/cli/main.py:39:33: FBT002 Boolean default positional argument in function definition
   |
37 |     """CLI interface for midjargon."""
38 |
39 |     def json(self, prompt: str, no_color: bool = False) -> None:
   |                                 ^^^^^^^^ FBT002
40 |         """Parse a prompt to MidjargonDict format.
   |

src/midjargon/cli/main.py:54:28: FBT001 Boolean-typed positional argument in function definition
   |
53 |     def mj(
54 |         self, prompt: str, json_output: bool = False, no_color: bool = False
   |                            ^^^^^^^^^^^ FBT001
55 |     ) -> None:
56 |         """Convert a prompt to Midjourney format.
   |

src/midjargon/cli/main.py:54:28: FBT002 Boolean default positional argument in function definition
   |
53 |     def mj(
54 |         self, prompt: str, json_output: bool = False, no_color: bool = False
   |                            ^^^^^^^^^^^ FBT002
55 |     ) -> None:
56 |         """Convert a prompt to Midjourney format.
   |

src/midjargon/cli/main.py:54:55: FBT001 Boolean-typed positional argument in function definition
   |
53 |     def mj(
54 |         self, prompt: str, json_output: bool = False, no_color: bool = False
   |                                                       ^^^^^^^^ FBT001
55 |     ) -> None:
56 |         """Convert a prompt to Midjourney format.
   |

src/midjargon/cli/main.py:54:55: FBT002 Boolean default positional argument in function definition
   |
53 |     def mj(
54 |         self, prompt: str, json_output: bool = False, no_color: bool = False
   |                                                       ^^^^^^^^ FBT002
55 |     ) -> None:
56 |         """Convert a prompt to Midjourney format.
   |

src/midjargon/cli/main.py:92:28: FBT001 Boolean-typed positional argument in function definition
   |
91 |     def fal(
92 |         self, prompt: str, json_output: bool = False, no_color: bool = False
   |                            ^^^^^^^^^^^ FBT001
93 |     ) -> None:
94 |         """Convert a prompt to Fal.ai format.
   |

src/midjargon/cli/main.py:92:28: FBT002 Boolean default positional argument in function definition
   |
91 |     def fal(
92 |         self, prompt: str, json_output: bool = False, no_color: bool = False
   |                            ^^^^^^^^^^^ FBT002
93 |     ) -> None:
94 |         """Convert a prompt to Fal.ai format.
   |

src/midjargon/cli/main.py:92:55: FBT001 Boolean-typed positional argument in function definition
   |
91 |     def fal(
92 |         self, prompt: str, json_output: bool = False, no_color: bool = False
   |                                                       ^^^^^^^^ FBT001
93 |     ) -> None:
94 |         """Convert a prompt to Fal.ai format.
   |

src/midjargon/cli/main.py:92:55: FBT002 Boolean default positional argument in function definition
   |
91 |     def fal(
92 |         self, prompt: str, json_output: bool = False, no_color: bool = False
   |                                                       ^^^^^^^^ FBT002
93 |     ) -> None:
94 |         """Convert a prompt to Fal.ai format.
   |

src/midjargon/cli/main.py:124:28: FBT001 Boolean-typed positional argument in function definition
    |
123 |     def perm(
124 |         self, prompt: str, json_output: bool = False, no_color: bool = False
    |                            ^^^^^^^^^^^ FBT001
125 |     ) -> None:
126 |         """Expand permutations in a prompt.
    |

src/midjargon/cli/main.py:124:28: FBT002 Boolean default positional argument in function definition
    |
123 |     def perm(
124 |         self, prompt: str, json_output: bool = False, no_color: bool = False
    |                            ^^^^^^^^^^^ FBT002
125 |     ) -> None:
126 |         """Expand permutations in a prompt.
    |

src/midjargon/cli/main.py:124:55: FBT001 Boolean-typed positional argument in function definition
    |
123 |     def perm(
124 |         self, prompt: str, json_output: bool = False, no_color: bool = False
    |                                                       ^^^^^^^^ FBT001
125 |     ) -> None:
126 |         """Expand permutations in a prompt.
    |

src/midjargon/cli/main.py:124:55: FBT002 Boolean default positional argument in function definition
    |
123 |     def perm(
124 |         self, prompt: str, json_output: bool = False, no_color: bool = False
    |                                                       ^^^^^^^^ FBT002
125 |     ) -> None:
126 |         """Expand permutations in a prompt.
    |

src/midjargon/core/input.py:8:5: C901 `parse_weighted_prompt` is too complex (12 > 10)
  |
8 | def parse_weighted_prompt(prompt: str) -> list[tuple[str, float]]:
  |     ^^^^^^^^^^^^^^^^^^^^^ C901
9 |     """Parse a prompt with optional weights.
  |

src/midjargon/core/main.py:9:36: FBT001 Boolean-typed positional argument in function definition
   |
 8 | def format_json_output(
 9 |     variants: list[PromptVariant], include_parsed: bool = False
   |                                    ^^^^^^^^^^^^^^ FBT001
10 | ) -> dict[str, Any]:
11 |     """Format prompt variants as JSON output.
   |

src/midjargon/core/main.py:9:36: FBT002 Boolean default positional argument in function definition
   |
 8 | def format_json_output(
 9 |     variants: list[PromptVariant], include_parsed: bool = False
   |                                    ^^^^^^^^^^^^^^ FBT002
10 | ) -> dict[str, Any]:
11 |     """Format prompt variants as JSON output.
   |

src/midjargon/core/models.py:31:9: C901 `_missing_` is too complex (16 > 10)
   |
30 |     @classmethod
31 |     def _missing_(cls, value: Any) -> Optional["MidjourneyVersion"]:
   |         ^^^^^^^^^ C901
32 |         """Handle missing values by trying to normalize the input."""
33 |         try:
   |

src/midjargon/core/models.py:31:9: PLR0911 Too many return statements (7 > 6)
   |
30 |     @classmethod
31 |     def _missing_(cls, value: Any) -> Optional["MidjourneyVersion"]:
   |         ^^^^^^^^^ PLR0911
32 |         """Handle missing values by trying to normalize the input."""
33 |         try:
   |

src/midjargon/core/models.py:31:9: PLR0912 Too many branches (16 > 12)
   |
30 |     @classmethod
31 |     def _missing_(cls, value: Any) -> Optional["MidjourneyVersion"]:
   |         ^^^^^^^^^ PLR0912
32 |         """Handle missing values by trying to normalize the input."""
33 |         try:
   |

src/midjargon/core/models.py:77:9: E722 Do not use bare `except`
   |
76 |             return None
77 |         except:
   |         ^^^^^^ E722
78 |             return None
   |

src/midjargon/core/models.py:140:9: E722 Do not use bare `except`
    |
138 |                 raise ValueError
139 |             return f"{w}:{h}"
140 |         except:
    |         ^^^^^^ E722
141 |             msg = "Invalid aspect ratio format. Expected W:H"
142 |             raise ValueError(msg)
    |

src/midjargon/core/models.py:142:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
140 |         except:
141 |             msg = "Invalid aspect ratio format. Expected W:H"
142 |             raise ValueError(msg)
    |             ^^^^^^^^^^^^^^^^^^^^^ B904
143 |
144 |     @field_validator("stylize")
    |

src/midjargon/core/models.py:216:17: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
214 |             except ValueError as e:
215 |                 msg = f"Invalid aspect ratio format: {e}"
216 |                 raise ValueError(msg)
    |                 ^^^^^^^^^^^^^^^^^^^^^ B904
217 |         return v
    |

src/midjargon/core/parameters.py:65:5: E722 Do not use bare `except`
   |
63 |         result = urlparse(value)
64 |         return all([result.scheme, result.netloc])
65 |     except:
   |     ^^^^^^ E722
66 |         return False
   |

src/midjargon/core/parameters.py:69:5: C901 `convert_parameter_value` is too complex (15 > 10)
   |
69 | def convert_parameter_value(param: str, value: str | None) -> Any:
   |     ^^^^^^^^^^^^^^^^^^^^^^^ C901
70 |     """Convert a parameter value to the appropriate type."""
71 |     # Handle flag parameters
   |

src/midjargon/core/parameters.py:69:5: PLR0911 Too many return statements (10 > 6)
   |
69 | def convert_parameter_value(param: str, value: str | None) -> Any:
   |     ^^^^^^^^^^^^^^^^^^^^^^^ PLR0911
70 |     """Convert a parameter value to the appropriate type."""
71 |     # Handle flag parameters
   |

src/midjargon/core/parameters.py:69:5: PLR0912 Too many branches (15 > 12)
   |
69 | def convert_parameter_value(param: str, value: str | None) -> Any:
   |     ^^^^^^^^^^^^^^^^^^^^^^^ PLR0912
70 |     """Convert a parameter value to the appropriate type."""
71 |     # Handle flag parameters
   |

src/midjargon/core/parameters.py:89:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
   |
87 |         except ValueError:
88 |             msg = f"Invalid version value: {value}"
89 |             raise ValueError(msg)
   |             ^^^^^^^^^^^^^^^^^^^^^ B904
90 |
91 |     # Handle integer parameters
   |

src/midjargon/core/parameters.py:97:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
   |
95 |         except ValueError:
96 |             msg = f"Invalid integer value for {param}: {value}"
97 |             raise ValueError(msg)
   |             ^^^^^^^^^^^^^^^^^^^^^ B904
98 |
99 |     # Handle float parameters
   |

src/midjargon/core/parameters.py:114:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
112 |         except ValueError:
113 |             msg = f"Invalid numeric value for {param}: {value}"
114 |             raise ValueError(msg)
    |             ^^^^^^^^^^^^^^^^^^^^^ B904
115 |
116 |     # Handle style parameter
    |

src/midjargon/core/parameters.py:122:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
120 |         except ValueError:
121 |             msg = f"Invalid style value: {value}"
122 |             raise ValueError(msg)
    |             ^^^^^^^^^^^^^^^^^^^^^ B904
123 |
124 |     # Handle character and style references
    |

src/midjargon/core/parameters.py:139:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
137 |         except Exception:
138 |             msg = f"Invalid reference value for {param}: {value}"
139 |             raise ValueError(msg)
    |             ^^^^^^^^^^^^^^^^^^^^^ B904
140 |
141 |     # Default case: return as string
    |

src/midjargon/core/parameters.py:145:5: C901 `parse_parameters` is too complex (14 > 10)
    |
145 | def parse_parameters(param_str: str) -> dict[str, Any]:
    |     ^^^^^^^^^^^^^^^^ C901
146 |     """Parse parameters from a string into a dictionary."""
147 |     if not param_str:
    |

src/midjargon/core/parameters.py:145:5: PLR0912 Too many branches (18 > 12)
    |
145 | def parse_parameters(param_str: str) -> dict[str, Any]:
    |     ^^^^^^^^^^^^^^^^ PLR0912
146 |     """Parse parameters from a string into a dictionary."""
147 |     if not param_str:
    |

src/midjargon/core/parameters.py:155:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
153 |     except ValueError as e:
154 |         msg = f"Failed to parse parameters: {e}"
155 |         raise ValueError(msg)
    |         ^^^^^^^^^^^^^^^^^^^^^ B904
156 |
157 |     result: dict[str, Any] = {}
    |

src/midjargon/core/parameters.py:188:21: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
186 |                 except Exception as e:
187 |                     msg = f"Failed to parse parameter {current_param}: {e}"
188 |                     raise ValueError(msg)
    |                     ^^^^^^^^^^^^^^^^^^^^^ B904
189 |
190 |             # Start new parameter
    |

src/midjargon/core/parameters.py:221:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
219 |         except Exception as e:
220 |             msg = f"Failed to parse parameter {current_param}: {e}"
221 |             raise ValueError(msg)
    |             ^^^^^^^^^^^^^^^^^^^^^ B904
222 |
223 |     return result
    |

src/midjargon/core/parser.py:24:5: E722 Do not use bare `except`
   |
22 |             )
23 |         )
24 |     except:
   |     ^^^^^^ E722
25 |         return False
   |

src/midjargon/core/parser.py:60:5: C901 `parse_parameters` is too complex (12 > 10)
   |
60 | def parse_parameters(param_str: str) -> dict[str, Any]:
   |     ^^^^^^^^^^^^^^^^ C901
61 |     """Parse parameter string into a dictionary.
   |

src/midjargon/core/parser.py:60:5: PLR0912 Too many branches (15 > 12)
   |
60 | def parse_parameters(param_str: str) -> dict[str, Any]:
   |     ^^^^^^^^^^^^^^^^ PLR0912
61 |     """Parse parameter string into a dictionary.
   |

src/midjargon/core/parser.py:146:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
144 |         except Exception as e:
145 |             msg = f"Failed to parse parameters: {e!s}"
146 |             raise ValueError(msg)
    |             ^^^^^^^^^^^^^^^^^^^^^ B904
147 |     else:
148 |         text_part = remaining_text.strip()
    |

src/midjargon/core/parser.py:160:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
158 |     except Exception as e:
159 |         msg = f"Failed to create prompt object: {e!s}"
160 |         raise ValueError(msg)
    |         ^^^^^^^^^^^^^^^^^^^^^ B904
    |

src/midjargon/core/permutations.py:127:9: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
125 |     except Exception as e:
126 |         msg = f"Failed to parse options at position {start}: {e!s}"
127 |         raise ValueError(msg)
    |         ^^^^^^^^^^^^^^^^^^^^^ B904
128 |
129 |     if not options:
    |

src/midjargon/core/permutations.py:145:13: B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
    |
143 |         except Exception as e:
144 |             msg = f"Failed to expand option '{option}': {e!s}"
145 |             raise ValueError(msg)
    |             ^^^^^^^^^^^^^^^^^^^^^ B904
146 |
147 |     return results
    |

tests/core/test_parameters.py:134:5: PLR0915 Too many statements (58 > 50)
    |
134 | def test_parse_parameters():
    |     ^^^^^^^^^^^^^^^^^^^^^ PLR0915
135 |     """Test parse_parameters function to verify parameter parsing."""
136 |     param_str = "--ar 16:9 --stylize 100"
    |

Found 46 errors.
============================= test session starts ==============================
platform darwin -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0 -- /Users/adam/Library/Application Support/hatch/env/virtual/midjargon/XMQ91zt9/hatch-test.py3.12/bin/python3
cachedir: .pytest_cache
rootdir: /Users/adam/Developer/vcs/github.twardoch/pub/twat-packages/midjargon
configfile: pyproject.toml
plugins: rerunfailures-14.0, anyio-4.8.0, mock-3.14.0, xdist-3.6.1
collecting ... collected 92 items

tests/cli/test_main.py::test_basic_prompt FAILED                         [  1%]
tests/cli/test_main.py::test_permutations FAILED                         [  2%]
tests/cli/test_main.py::test_raw_output FAILED                           [  3%]
tests/cli/test_main.py::test_json_output_formatting FAILED               [  4%]
tests/cli/test_main.py::test_invalid_input FAILED                        [  5%]
tests/cli/test_main.py::test_parameter_validation FAILED                 [  6%]
tests/cli/test_main.py::test_image_url_handling FAILED                   [  7%]
tests/cli/test_main.py::test_no_color_output FAILED                      [  8%]
tests/cli/test_main.py::test_complex_prompt FAILED                       [  9%]
tests/cli/test_main.py::test_personalization_parameter FAILED            [ 10%]
tests/cli/test_main.py::test_numeric_range_permutations FAILED           [ 11%]
tests/cli/test_main.py::test_nested_parameter_permutations FAILED        [ 13%]
tests/cli/test_main.py::test_mj_command FAILED                           [ 14%]
tests/cli/test_main.py::test_fal_command FAILED                          [ 15%]
tests/cli/test_main.py::test_perm_command FAILED                         [ 16%]
tests/core/test_input.py::test_basic_input FAILED                        [ 17%]
tests/core/test_input.py::test_single_permutation FAILED                 [ 18%]
tests/core/test_input.py::test_empty_input FAILED                        [ 19%]
tests/core/test_input.py::test_multiple_permutations FAILED              [ 20%]
tests/core/test_input.py::test_nested_permutations FAILED                [ 21%]
tests/core/test_input.py::test_escaped_braces FAILED                     [ 22%]
tests/core/test_input.py::test_escaped_commas FAILED                     [ 23%]
tests/core/test_input.py::test_unmatched_braces FAILED                   [ 25%]
tests/core/test_input.py::test_empty_permutation FAILED                  [ 26%]
tests/core/test_input.py::test_whitespace_handling FAILED                [ 27%]
tests/core/test_input.py::test_expand_midjargon_input FAILED             [ 28%]
tests/core/test_input.py::test_handling_escaped_characters FAILED        [ 29%]
tests/core/test_parameters.py::test_basic_parameter_parsing FAILED       [ 30%]
tests/core/test_parameters.py::test_flag_parameters FAILED               [ 31%]
tests/core/test_parameters.py::test_parameter_with_multiple_values FAILED [ 32%]
tests/core/test_parameters.py::test_parameter_with_spaces FAILED         [ 33%]
tests/core/test_parameters.py::test_mixed_parameters FAILED              [ 34%]
tests/core/test_parameters.py::test_shorthand_parameters FAILED          [ 35%]
tests/core/test_parameters.py::test_niji_version_parameter FAILED        [ 36%]
tests/core/test_parameters.py::test_version_parameter FAILED             [ 38%]
tests/core/test_parameters.py::test_personalization_parameter FAILED     [ 39%]
tests/core/test_parameters.py::test_reference_parameters FAILED          [ 40%]
tests/core/test_parameters.py::test_parameter_order PASSED               [ 41%]
tests/core/test_parameters.py::test_invalid_parameters FAILED            [ 42%]
tests/core/test_parameters.py::test_parse_parameters FAILED              [ 43%]
tests/core/test_parameters.py::test_flag_parameters_handling FAILED      [ 44%]
tests/core/test_parameters.py::test_special_seed_values FAILED           [ 45%]
tests/core/test_parameters.py::test_reference_url_handling FAILED        [ 46%]
tests/core/test_parameters.py::test_niji_version_handling FAILED         [ 47%]
tests/core/test_parser.py::test_basic_prompt_parsing FAILED              [ 48%]
tests/core/test_parser.py::test_prompt_with_image_url FAILED             [ 50%]
tests/core/test_parser.py::test_prompt_with_multiple_image_urls FAILED   [ 51%]
tests/core/test_parser.py::test_prompt_with_parameters FAILED            [ 52%]
tests/core/test_parser.py::test_prompt_with_empty_parameters FAILED      [ 53%]
tests/core/test_parser.py::test_prompt_with_escaped_characters PASSED    [ 54%]
tests/core/test_parser.py::test_prompt_with_nested_permutations PASSED   [ 55%]
tests/core/test_parser.py::test_prompt_with_unmatched_braces PASSED      [ 56%]
tests/core/test_parser.py::test_prompt_with_empty_permutation PASSED     [ 57%]
tests/core/test_parser.py::test_prompt_with_whitespace_handling PASSED   [ 58%]
tests/engines/midjourney/test_midjourney_parser.py::test_numeric_parameters PASSED [ 59%]
tests/engines/midjourney/test_midjourney_parser.py::test_style_parameters PASSED [ 60%]
tests/engines/midjourney/test_midjourney_parser.py::test_aspect_ratio FAILED [ 61%]
tests/engines/midjourney/test_midjourney_parser.py::test_image_prompts PASSED [ 63%]
tests/engines/midjourney/test_midjourney_parser.py::test_extra_parameters PASSED [ 64%]
tests/engines/midjourney/test_midjourney_parser.py::test_parameter_conversion PASSED [ 65%]
tests/engines/midjourney/test_midjourney_parser.py::test_invalid_values FAILED [ 66%]
tests/engines/midjourney/test_midjourney_parser.py::test_empty_values FAILED [ 67%]
tests/engines/midjourney/test_midjourney_parser.py::test_version_parameter PASSED [ 68%]
tests/engines/midjourney/test_midjourney_parser.py::test_multiple_permutations PASSED [ 69%]
tests/engines/midjourney/test_midjourney_parser.py::test_personalization_parameter PASSED [ 70%]
tests/engines/midjourney/test_midjourney_parser.py::test_edge_cases PASSED [ 71%]
tests/integration/test_workflow.py::test_basic_workflow FAILED           [ 72%]
tests/integration/test_workflow.py::test_permutation_workflow FAILED     [ 73%]
tests/integration/test_workflow.py::test_image_workflow FAILED           [ 75%]
tests/integration/test_workflow.py::test_parameter_workflow FAILED       [ 76%]
tests/integration/test_workflow.py::test_new_parameters_workflow FAILED  [ 77%]
tests/integration/test_workflow.py::test_weighted_prompts_workflow FAILED [ 78%]
tests/integration/test_workflow.py::test_error_workflow FAILED           [ 79%]
tests/integration/test_workflow.py::test_complex_workflow FAILED         [ 80%]
tests/integration/test_workflow.py::test_permutations_with_parameters FAILED [ 81%]
tests/integration/test_workflow.py::test_permutations_with_flag_parameters FAILED [ 82%]
tests/integration/test_workflow.py::test_permutations_with_complex_parameters FAILED [ 83%]
tests/integration/test_workflow.py::test_cli_mj_command FAILED           [ 84%]
tests/integration/test_workflow.py::test_cli_fal_command FAILED          [ 85%]
tests/integration/test_workflow.py::test_cli_perm_command FAILED         [ 86%]
tests/test_core.py::test_basic_prompt_parsing PASSED                     [ 88%]
tests/test_core.py::test_prompt_with_parameters FAILED                   [ 89%]
tests/test_core.py::test_prompt_with_image PASSED                        [ 90%]
tests/test_core.py::test_invalid_parameters FAILED                       [ 91%]
tests/test_core.py::test_permutation_expansion PASSED                    [ 92%]
tests/test_core.py::test_escaped_permutations PASSED                     [ 93%]
tests/test_core.py::test_weighted_prompts FAILED                         [ 94%]
tests/test_core.py::test_combined_features FAILED                        [ 95%]
tests/test_core.py::test_style_reference PASSED                          [ 96%]
tests/test_core.py::test_character_reference FAILED                      [ 97%]
tests/test_core.py::test_prompt_to_string FAILED                         [ 98%]
tests/test_package.py::test_version PASSED                               [100%]

=================================== FAILURES ===================================
______________________________ test_basic_prompt _______________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10ef93ec0>

    def test_basic_prompt(cli):
        """Test basic prompt processing."""
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.json(
                f"a beautiful landscape --ar {ASPECT_WIDTH}:{ASPECT_HEIGHT}",
                json_output=True,
            )
E           TypeError: MidjargonCLI.json() got an unexpected keyword argument 'json_output'

tests/cli/test_main.py:58: TypeError
______________________________ test_permutations _______________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10f3dfd70>

    def test_permutations(cli):
        """Test permutation processing."""
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
            cli.perm("a {red, blue} bird", json_output=True)
            sys.stdout = sys.__stdout__
>           data = parse_json_output(capture_stdout)

tests/cli/test_main.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

output_stream = <_io.StringIO object at 0x10fa4c100>

    def parse_json_output(output_stream: StringIO) -> Any:
        """Parse JSON output from the CLI, removing ANSI escape sequences if any."""
        output_stream.seek(0)
        output = output_stream.getvalue()
        # Remove ANSI escape sequences
        output = ANSI_ESCAPE.sub("", output)
        output = output.strip()
        if not output:
            msg = "No JSON found in output"
>           raise ValueError(msg)
E           ValueError: No JSON found in output

tests/cli/test_main.py:40: ValueError
_______________________________ test_raw_output ________________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fad9bb0>

    def test_raw_output(cli):
        """Test raw output mode."""
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.json(f"a photo --stylize {STYLIZE_VALUE}", json_output=True)
E           TypeError: MidjargonCLI.json() got an unexpected keyword argument 'json_output'

tests/cli/test_main.py:86: TypeError
_________________________ test_json_output_formatting __________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fa3c1d0>

    def test_json_output_formatting(cli):
        """Test JSON output formatting."""
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.json("a photo", json_output=True)
E           TypeError: MidjargonCLI.json() got an unexpected keyword argument 'json_output'

tests/cli/test_main.py:98: TypeError
______________________________ test_invalid_input ______________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fa3c8f0>

    def test_invalid_input(cli):
        """Test handling of invalid input."""
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.json("", json_output=True)
E           TypeError: MidjargonCLI.json() got an unexpected keyword argument 'json_output'

tests/cli/test_main.py:110: TypeError
__________________________ test_parameter_validation ___________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fa3cfb0>

    def test_parameter_validation(cli):
        """Test parameter validation."""
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.json(
                f"a photo --stylize {STYLIZE_VALUE * 20}", json_output=True
            )  # Over max
E           TypeError: MidjargonCLI.json() got an unexpected keyword argument 'json_output'

tests/cli/test_main.py:120: TypeError
___________________________ test_image_url_handling ____________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fa3d790>

    def test_image_url_handling(cli):
        """Test handling of image URLs."""
        url = "https://example.com/image.jpg"
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.json(f"{url} a fusion", json_output=True)
E           TypeError: MidjargonCLI.json() got an unexpected keyword argument 'json_output'

tests/cli/test_main.py:133: TypeError
_____________________________ test_no_color_output _____________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fa3e000>

    def test_no_color_output(cli):
        """Test no-color output mode."""
        Console(force_terminal=False)
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.json("a photo", json_output=True, no_color=True)
E           TypeError: MidjargonCLI.json() got an unexpected keyword argument 'json_output'

tests/cli/test_main.py:147: TypeError
_____________________________ test_complex_prompt ______________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fa3e930>

    def test_complex_prompt(cli):
        """Test complex prompt with multiple features."""
        prompt = (
            "https://example.com/img1.jpg https://example.com/img2.jpg "
            "a {red, blue} bird on a {branch, rock} "
            f"--ar {ASPECT_WIDTH}:{ASPECT_HEIGHT} --stylize {STYLIZE_VALUE} --chaos {CHAOS_VALUE}"
        )
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.json(prompt, json_output=True)
E           TypeError: MidjargonCLI.json() got an unexpected keyword argument 'json_output'

tests/cli/test_main.py:163: TypeError
________________________ test_personalization_parameter ________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fa3f380>

    def test_personalization_parameter(cli):
        """Test personalization parameter handling in different forms."""
        # Test flag form (--p)
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.json("a photo --p", json_output=True)
E           TypeError: MidjargonCLI.json() got an unexpected keyword argument 'json_output'

tests/cli/test_main.py:180: TypeError
_______________________ test_numeric_range_permutations ________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10f9f6f00>

    def test_numeric_range_permutations(cli):
        """Test handling of numeric parameters in permutations."""
        # Test stylize parameter range
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.json("a photo --s {75, 300}", json_output=True)
E           TypeError: MidjargonCLI.json() got an unexpected keyword argument 'json_output'

tests/cli/test_main.py:210: TypeError
______________________ test_nested_parameter_permutations ______________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fadab70>

    def test_nested_parameter_permutations(cli):
        """Test handling of nested permutations with parameters."""
        # Test personalization with nested options
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.json("smooth edges {, --p {, CODE1}} --s {75, 300}", json_output=True)
E           TypeError: MidjargonCLI.json() got an unexpected keyword argument 'json_output'

tests/cli/test_main.py:237: TypeError
_______________________________ test_mj_command ________________________________

self = <midjargon.cli.main.MidjargonCLI object at 0x10fadb2f0>
prompt = 'a serene landscape --ar 16:9 --stylize 100', json_output = True
no_color = False

    def mj(
        self, prompt: str, json_output: bool = False, no_color: bool = False
    ) -> None:
        """Convert a prompt to Midjourney format.
    
        Args:
            prompt: The prompt to convert.
            json_output: Whether to output JSON.
            no_color: Whether to disable colored output.
        """
        try:
            variants = expand_midjargon_input(prompt)
            parser = MidjourneyParser()
            results = []
            for variant in variants:
>               mj_prompt = parser.parse_dict(variant.prompt.model_dump())

src/midjargon/cli/main.py:68: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <midjargon.engines.midjourney.midjourney.MidjourneyParser object at 0x10fadb4a0>
prompt_dict = {'aspect_height': None, 'aspect_ratio': None, 'aspect_width': None, 'chaos': 0, ...}

    def parse_dict(self, prompt_dict: dict[str, Any]) -> MidjourneyPrompt:
        """Parse a dictionary into a MidjourneyPrompt.
    
        Args:
            prompt_dict: Dictionary containing prompt data.
    
        Returns:
            MidjourneyPrompt instance.
    
        Raises:
            ValueError: If the prompt text is empty.
        """
        # Validate text
        text = prompt_dict.pop("text", "").strip()
        if not text:
            msg = "Empty prompt"
            raise ValueError(msg)
    
        # Extract known fields
        known_fields = set(MidjourneyPrompt.model_fields)
    
        # Split into known and extra parameters
        params = {}
        extra_params = {}
        for key, value in prompt_dict.items():
            if key in known_fields:
                params[key] = value
            else:
                extra_params[key] = value
    
        # Create prompt with all parameters
>       return MidjourneyPrompt(text=text, **params, extra_params=extra_params)
E       TypeError: midjargon.core.models.MidjourneyPrompt() got multiple values for keyword argument 'extra_params'

src/midjargon/engines/midjourney/midjourney.py:46: TypeError

During handling of the above exception, another exception occurred:

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fadb2f0>

    def test_mj_command(cli):
        """Test Midjourney prompt conversion."""
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.mj("a serene landscape --ar 16:9 --stylize 100", json_output=True)

tests/cli/test_main.py:283: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <midjargon.cli.main.MidjargonCLI object at 0x10fadb2f0>
prompt = 'a serene landscape --ar 16:9 --stylize 100', json_output = True
no_color = False

    def mj(
        self, prompt: str, json_output: bool = False, no_color: bool = False
    ) -> None:
        """Convert a prompt to Midjourney format.
    
        Args:
            prompt: The prompt to convert.
            json_output: Whether to output JSON.
            no_color: Whether to disable colored output.
        """
        try:
            variants = expand_midjargon_input(prompt)
            parser = MidjourneyParser()
            results = []
            for variant in variants:
                mj_prompt = parser.parse_dict(variant.prompt.model_dump())
                results.append(mj_prompt.model_dump())
    
            if json_output:
                pass
            else:
                for i, result in enumerate(results):
                    if len(results) > 1:
                        console.print(f"{i + 1}. ", end="", highlight=not no_color)
                    params = " ".join(
                        f"--{k} {v}"
                        for k, v in result.items()
                        if k not in {"text", "image_prompts", "extra_params"}
                        and v is not None
                    )
                    console.print(
                        f"{result['text']} {params}",
                        highlight=not no_color,
                    )
        except Exception as e:
            error_console.print(f"[red]Error:[/red] {e!s}", highlight=not no_color)
>           sys.exit(1)
E           SystemExit: 1

src/midjargon/cli/main.py:89: SystemExit
----------------------------- Captured stderr call -----------------------------
Error: midjargon.core.models.MidjourneyPrompt() got multiple values for keyword 
argument 'extra_params'
_______________________________ test_fal_command _______________________________

self = <midjargon.cli.main.MidjargonCLI object at 0x10fa3d2b0>
prompt = 'a serene landscape --ar 16:9 --stylize 100', json_output = True
no_color = False

    def fal(
        self, prompt: str, json_output: bool = False, no_color: bool = False
    ) -> None:
        """Convert a prompt to Fal.ai format.
    
        Args:
            prompt: The prompt to convert.
            json_output: Whether to output JSON.
            no_color: Whether to disable colored output.
        """
        try:
            variants = expand_midjargon_input(prompt)
            parser = FalParser()
            results = []
            for variant in variants:
>               fal_prompt = parser.parse_dict(variant.prompt.model_dump())

src/midjargon/cli/main.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <midjargon.engines.fal.fal.FalParser object at 0x10fa3d940>
prompt_dict = {'aspect_height': None, 'aspect_ratio': None, 'aspect_width': None, 'chaos': 0, ...}

    def parse_dict(self, prompt_dict: dict[str, Any]) -> FalPrompt:
        """Parse a dictionary into a FalPrompt.
    
        Args:
            prompt_dict: Dictionary containing prompt data.
    
        Returns:
            FalPrompt instance.
    
        Raises:
            ValueError: If the prompt text is empty.
        """
        # Validate text
        text = prompt_dict.pop("text", "").strip()
        if not text:
            msg = "Empty prompt"
            raise ValueError(msg)
    
        # Extract known fields
        known_fields = set(FalPrompt.model_fields)
    
        # Split into known and extra parameters
        params = {}
        extra_params = {}
        for key, value in prompt_dict.items():
            if key in known_fields:
                params[key] = value
            else:
                extra_params[key] = value
    
        # Create prompt with all parameters
>       return FalPrompt(text=text, **params, extra_params=extra_params)
E       TypeError: midjargon.engines.fal.fal.FalPrompt() got multiple values for keyword argument 'extra_params'

src/midjargon/engines/fal/fal.py:102: TypeError

During handling of the above exception, another exception occurred:

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fa3d2b0>

    def test_fal_command(cli):
        """Test Fal.ai prompt conversion."""
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.fal("a serene landscape --ar 16:9 --stylize 100", json_output=True)

tests/cli/test_main.py:296: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <midjargon.cli.main.MidjargonCLI object at 0x10fa3d2b0>
prompt = 'a serene landscape --ar 16:9 --stylize 100', json_output = True
no_color = False

    def fal(
        self, prompt: str, json_output: bool = False, no_color: bool = False
    ) -> None:
        """Convert a prompt to Fal.ai format.
    
        Args:
            prompt: The prompt to convert.
            json_output: Whether to output JSON.
            no_color: Whether to disable colored output.
        """
        try:
            variants = expand_midjargon_input(prompt)
            parser = FalParser()
            results = []
            for variant in variants:
                fal_prompt = parser.parse_dict(variant.prompt.model_dump())
                results.append(fal_prompt.model_dump())
    
            if json_output:
                pass
            else:
                for i, result in enumerate(results):
                    if len(results) > 1:
                        console.print(f"{i + 1}. ", end="", highlight=not no_color)
                    console.print(
                        result["text"],
                        highlight=not no_color,
                    )
        except Exception as e:
            error_console.print(f"[red]Error:[/red] {e!s}", highlight=not no_color)
>           sys.exit(1)
E           SystemExit: 1

src/midjargon/cli/main.py:121: SystemExit
----------------------------- Captured stderr call -----------------------------
Error: midjargon.engines.fal.fal.FalPrompt() got multiple values for keyword 
argument 'extra_params'
______________________________ test_perm_command _______________________________

cli = <midjargon.cli.main.MidjargonCLI object at 0x10fa3d190>

    def test_perm_command(cli):
        """Test permutation expansion."""
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
            cli.perm("a {red, blue} bird on a {branch, rock}", json_output=True)
            sys.stdout = sys.__stdout__
>           data = parse_json_output(capture_stdout)

tests/cli/test_main.py:311: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

output_stream = <_io.StringIO object at 0x10fa4c040>

    def parse_json_output(output_stream: StringIO) -> Any:
        """Parse JSON output from the CLI, removing ANSI escape sequences if any."""
        output_stream.seek(0)
        output = output_stream.getvalue()
        # Remove ANSI escape sequences
        output = ANSI_ESCAPE.sub("", output)
        output = output.strip()
        if not output:
            msg = "No JSON found in output"
>           raise ValueError(msg)
E           ValueError: No JSON found in output

tests/cli/test_main.py:40: ValueError
_______________________________ test_basic_input _______________________________

    def test_basic_input():
        """Test basic input without permutations."""
        result = expand_midjargon_input("a simple prompt")
        assert len(result) == 1
>       assert result[0] == "a simple prompt"
E       AssertionError: assert PromptVariant(prompt=MidjourneyPrompt(text='a simple prompt', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0) == 'a simple prompt'

tests/core/test_input.py:15: AssertionError
___________________________ test_single_permutation ____________________________

    def test_single_permutation():
        """Test input with a single permutation."""
        result = expand_midjargon_input("a {red, blue} bird")
        assert len(result) == PERMUTATION_COUNT_2
>       assert "a red bird" in result
E       AssertionError: assert 'a red bird' in [PromptVariant(prompt=MidjourneyPrompt(text='a red bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0), PromptVariant(prompt=MidjourneyPrompt(text='a blue bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0)]

tests/core/test_input.py:22: AssertionError
_______________________________ test_empty_input _______________________________

    def test_empty_input():
        """Test empty input handling."""
        result = expand_midjargon_input("")
        assert len(result) == 1
>       assert result[0] == ""
E       AssertionError: assert PromptVariant(prompt=MidjourneyPrompt(text='', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0) == ''

tests/core/test_input.py:30: AssertionError
__________________________ test_multiple_permutations __________________________

    def test_multiple_permutations():
        """Test input with multiple permutations."""
        result = expand_midjargon_input("a {red, blue, green} bird")
        assert len(result) == PERMUTATION_COUNT_3
>       assert "a red bird" in result
E       AssertionError: assert 'a red bird' in [PromptVariant(prompt=MidjourneyPrompt(text='a red bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0), PromptVariant(prompt=MidjourneyPrompt(text='a blue bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0), PromptVariant(prompt=MidjourneyPrompt(text='a green bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0)]

tests/core/test_input.py:37: AssertionError
___________________________ test_nested_permutations ___________________________

s = 'a {red {cat, dog}, blue bird}'

    def expand_permutations(s: str) -> list[str]:
        """Recursively expand permutations in the prompt string using {a, b, ...} syntax.
    
        Handles:
        - Nested permutation groups
        - Escaped characters (\\, \\{, \\}, \\,)
        - Proper error reporting
    
        Args:
            s: String containing permutation groups.
    
        Returns:
            List of all possible permutations.
    
        Raises:
            ValueError: If the permutation syntax is invalid.
        """
        # Find first unescaped opening brace
        start = find_unescaped(s, "{")
        if start == -1:
            return [s]
    
        # Find matching closing brace
        end, error = find_matching_brace(s, start)
        if end == -1:
            raise ValueError(error)
    
        # Extract and split options
        options_str = s[start + 1 : end]
        try:
            options = split_unescaped(options_str)
        except Exception as e:
            msg = f"Failed to parse options at position {start}: {e!s}"
            raise ValueError(msg)
    
        if not options:
            msg = f"Empty permutation group at position {start}"
            raise ValueError(msg)
    
        # Recursively expand each option
        results = []
        prefix = s[:start]
        suffix = s[end + 1 :]
    
        for option in options:
            # Replace the entire '{...}' with the option
            new_s = prefix + option + suffix
            try:
>               results.extend(expand_permutations(new_s))

src/midjargon/core/permutations.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

s = 'a red {cat'

    def expand_permutations(s: str) -> list[str]:
        """Recursively expand permutations in the prompt string using {a, b, ...} syntax.
    
        Handles:
        - Nested permutation groups
        - Escaped characters (\\, \\{, \\}, \\,)
        - Proper error reporting
    
        Args:
            s: String containing permutation groups.
    
        Returns:
            List of all possible permutations.
    
        Raises:
            ValueError: If the permutation syntax is invalid.
        """
        # Find first unescaped opening brace
        start = find_unescaped(s, "{")
        if start == -1:
            return [s]
    
        # Find matching closing brace
        end, error = find_matching_brace(s, start)
        if end == -1:
>           raise ValueError(error)
E           ValueError: Unclosed brace at position 6

src/midjargon/core/permutations.py:119: ValueError

During handling of the above exception, another exception occurred:

    def test_nested_permutations():
        """Test input with nested permutations."""
>       result = expand_midjargon_input("a {red {cat, dog}, blue bird}")

tests/core/test_input.py:44: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/midjargon/core/input.py:84: in expand_midjargon_input
    permutation_options = expand_permutations(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

s = 'a {red {cat, dog}, blue bird}'

    def expand_permutations(s: str) -> list[str]:
        """Recursively expand permutations in the prompt string using {a, b, ...} syntax.
    
        Handles:
        - Nested permutation groups
        - Escaped characters (\\, \\{, \\}, \\,)
        - Proper error reporting
    
        Args:
            s: String containing permutation groups.
    
        Returns:
            List of all possible permutations.
    
        Raises:
            ValueError: If the permutation syntax is invalid.
        """
        # Find first unescaped opening brace
        start = find_unescaped(s, "{")
        if start == -1:
            return [s]
    
        # Find matching closing brace
        end, error = find_matching_brace(s, start)
        if end == -1:
            raise ValueError(error)
    
        # Extract and split options
        options_str = s[start + 1 : end]
        try:
            options = split_unescaped(options_str)
        except Exception as e:
            msg = f"Failed to parse options at position {start}: {e!s}"
            raise ValueError(msg)
    
        if not options:
            msg = f"Empty permutation group at position {start}"
            raise ValueError(msg)
    
        # Recursively expand each option
        results = []
        prefix = s[:start]
        suffix = s[end + 1 :]
    
        for option in options:
            # Replace the entire '{...}' with the option
            new_s = prefix + option + suffix
            try:
                results.extend(expand_permutations(new_s))
            except Exception as e:
                msg = f"Failed to expand option '{option}': {e!s}"
>               raise ValueError(msg)
E               ValueError: Failed to expand option 'red {cat': Unclosed brace at position 6

src/midjargon/core/permutations.py:145: ValueError
_____________________________ test_escaped_braces ______________________________

    def test_escaped_braces():
        """Test input with escaped braces."""
        result = expand_midjargon_input(r"a \{red, blue\} bird")
        assert len(result) == 1
>       assert result[0] == "a {red, blue} bird"
E       AssertionError: assert PromptVariant(prompt=MidjourneyPrompt(text='a \\{red, blue\\} bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0) == 'a {red, blue} bird'

tests/core/test_input.py:55: AssertionError
_____________________________ test_escaped_commas ______________________________

    def test_escaped_commas():
        """Test input with escaped commas."""
        result = expand_midjargon_input(r"a {red\, blue, green} bird")
        assert len(result) == PERMUTATION_COUNT_2
>       assert "a red, blue bird" in result
E       AssertionError: assert 'a red, blue bird' in [PromptVariant(prompt=MidjourneyPrompt(text='a red, blue bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0), PromptVariant(prompt=MidjourneyPrompt(text='a green bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0)]

tests/core/test_input.py:62: AssertionError
____________________________ test_unmatched_braces _____________________________

    def test_unmatched_braces():
        """Test input with unmatched braces."""
>       result = expand_midjargon_input("a {red, blue bird")

tests/core/test_input.py:68: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/midjargon/core/input.py:84: in expand_midjargon_input
    permutation_options = expand_permutations(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

s = 'a {red, blue bird'

    def expand_permutations(s: str) -> list[str]:
        """Recursively expand permutations in the prompt string using {a, b, ...} syntax.
    
        Handles:
        - Nested permutation groups
        - Escaped characters (\\, \\{, \\}, \\,)
        - Proper error reporting
    
        Args:
            s: String containing permutation groups.
    
        Returns:
            List of all possible permutations.
    
        Raises:
            ValueError: If the permutation syntax is invalid.
        """
        # Find first unescaped opening brace
        start = find_unescaped(s, "{")
        if start == -1:
            return [s]
    
        # Find matching closing brace
        end, error = find_matching_brace(s, start)
        if end == -1:
>           raise ValueError(error)
E           ValueError: Unclosed brace at position 2

src/midjargon/core/permutations.py:119: ValueError
____________________________ test_empty_permutation ____________________________

    def test_empty_permutation():
        """Test input with empty permutation options."""
>       result = expand_midjargon_input("a {} bird")

tests/core/test_input.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/midjargon/core/input.py:84: in expand_midjargon_input
    permutation_options = expand_permutations(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

s = 'a {} bird'

    def expand_permutations(s: str) -> list[str]:
        """Recursively expand permutations in the prompt string using {a, b, ...} syntax.
    
        Handles:
        - Nested permutation groups
        - Escaped characters (\\, \\{, \\}, \\,)
        - Proper error reporting
    
        Args:
            s: String containing permutation groups.
    
        Returns:
            List of all possible permutations.
    
        Raises:
            ValueError: If the permutation syntax is invalid.
        """
        # Find first unescaped opening brace
        start = find_unescaped(s, "{")
        if start == -1:
            return [s]
    
        # Find matching closing brace
        end, error = find_matching_brace(s, start)
        if end == -1:
            raise ValueError(error)
    
        # Extract and split options
        options_str = s[start + 1 : end]
        try:
            options = split_unescaped(options_str)
        except Exception as e:
            msg = f"Failed to parse options at position {start}: {e!s}"
            raise ValueError(msg)
    
        if not options:
            msg = f"Empty permutation group at position {start}"
>           raise ValueError(msg)
E           ValueError: Empty permutation group at position 2

src/midjargon/core/permutations.py:131: ValueError
___________________________ test_whitespace_handling ___________________________

    def test_whitespace_handling():
        """Test input with various whitespace patterns."""
        result = expand_midjargon_input("a {  red  ,  blue  } bird")
        assert len(result) == PERMUTATION_COUNT_2
>       assert "a red bird" in result
E       AssertionError: assert 'a red bird' in [PromptVariant(prompt=MidjourneyPrompt(text='a red bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0), PromptVariant(prompt=MidjourneyPrompt(text='a blue bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0)]

tests/core/test_input.py:84: AssertionError
_________________________ test_expand_midjargon_input __________________________

    def test_expand_midjargon_input():
        """Test expand_midjargon_input function to verify prompt expansion."""
        result = expand_midjargon_input("a {red, blue} bird")
        assert len(result) == 2
>       assert "a red bird" in result
E       AssertionError: assert 'a red bird' in [PromptVariant(prompt=MidjourneyPrompt(text='a red bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0), PromptVariant(prompt=MidjourneyPrompt(text='a blue bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0)]

tests/core/test_input.py:92: AssertionError
_______________________ test_handling_escaped_characters _______________________

    def test_handling_escaped_characters():
        """Test handling of escaped characters in expand_midjargon_input."""
        result = expand_midjargon_input(r"a \{red, blue\} bird")
        assert len(result) == 1
>       assert result[0] == "a {red, blue} bird"
E       AssertionError: assert PromptVariant(prompt=MidjourneyPrompt(text='a \\{red, blue\\} bird', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0) == 'a {red, blue} bird'

tests/core/test_input.py:112: AssertionError
_________________________ test_basic_parameter_parsing _________________________

    def test_basic_parameter_parsing():
        """Test parsing of basic parameters."""
        param_str = "--ar 16:9 --stylize 100"
        params = parse_parameters(param_str)
        assert params["aspect"] == "16:9"
>       assert params["stylize"] == "100"
E       AssertionError: assert 100.0 == '100'

tests/core/test_parameters.py:14: AssertionError
_____________________________ test_flag_parameters _____________________________

    def test_flag_parameters():
        """Test parsing of flag parameters (without values)."""
        param_str = "--tile --turbo --relax"
        params = parse_parameters(param_str)
>       assert params["tile"] is None
E       assert True is None

tests/core/test_parameters.py:21: AssertionError
_____________________ test_parameter_with_multiple_values ______________________

    def test_parameter_with_multiple_values():
        """Test parsing parameters that accept multiple values."""
        param_str = "--no blur,cars,watermark"
        params = parse_parameters(param_str)
>       assert params["no"] == "blur,cars,watermark"
E       AssertionError: assert ['blur,cars,watermark'] == 'blur,cars,watermark'

tests/core/test_parameters.py:30: AssertionError
__________________________ test_parameter_with_spaces __________________________

param = 'style', value = 'raw photo'

    def convert_parameter_value(param: str, value: str | None) -> Any:
        """Convert a parameter value to the appropriate type."""
        # Handle flag parameters
        if param in FLAG_PARAMS:
            return True if value is None else value.lower() == "true"
    
        # Handle empty values
        if value is None:
            return None
    
        # Handle string parameters
        if param in STRING_PARAMS:
            return str(value)
    
        # Handle version parameter
        if param == "version":
            try:
                return MidjourneyVersion(value)
            except ValueError:
                msg = f"Invalid version value: {value}"
                raise ValueError(msg)
    
        # Handle integer parameters
        if param in INT_PARAMS:
            try:
                return int(value)
            except ValueError:
                msg = f"Invalid integer value for {param}: {value}"
                raise ValueError(msg)
    
        # Handle float parameters
        if param in {
            "stylize",
            "chaos",
            "weird",
            "quality",
            "character_weight",
            "style_weight",
            "image_weight",
            "stop",
        }:
            try:
                return float(value)
            except ValueError:
                msg = f"Invalid numeric value for {param}: {value}"
                raise ValueError(msg)
    
        # Handle style parameter
        if param == "style":
            try:
>               return StyleMode(value)

src/midjargon/core/parameters.py:119: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/enum.py:751: in __call__
    return cls.__new__(cls, value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <enum 'StyleMode'>, value = 'raw photo'

    def __new__(cls, value):
        # all enum instances are actually created during class construction
        # without calling this method; this method is called by the metaclass'
        # __call__ (i.e. Color(3) ), and by pickle
        if type(value) is cls:
            # For lookups like Color(Color.RED)
            return value
        # by-value search for a matching enum member
        # see if it's in the reverse mapping (for hashable values)
        try:
            return cls._value2member_map_[value]
        except KeyError:
            # Not found, no need to do long O(n) search
            pass
        except TypeError:
            # not there, now do long search -- O(n) behavior
            for member in cls._member_map_.values():
                if member._value_ == value:
                    return member
        # still not found -- verify that members exist, in-case somebody got here mistakenly
        # (such as via super when trying to override __new__)
        if not cls._member_map_:
            raise TypeError("%r has no members defined" % cls)
        #
        # still not found -- try _missing_ hook
        try:
            exc = None
            result = cls._missing_(value)
        except Exception as e:
            exc = e
            result = None
        try:
            if isinstance(result, cls):
                return result
            elif (
                    Flag is not None and issubclass(cls, Flag)
                    and cls._boundary_ is EJECT and isinstance(result, int)
                ):
                return result
            else:
                ve_exc = ValueError("%r is not a valid %s" % (value, cls.__qualname__))
                if result is None and exc is None:
>                   raise ve_exc
E                   ValueError: 'raw photo' is not a valid StyleMode

/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/enum.py:1165: ValueError

During handling of the above exception, another exception occurred:

param_str = '--style "raw photo" --seed 123456'

    def parse_parameters(param_str: str) -> dict[str, Any]:
        """Parse parameters from a string into a dictionary."""
        if not param_str:
            return {}
    
        # Split parameters while preserving quoted strings
        try:
            parts = shlex.split(param_str)
        except ValueError as e:
            msg = f"Failed to parse parameters: {e}"
            raise ValueError(msg)
    
        result: dict[str, Any] = {}
        current_param = None
        current_values = []
    
        for part in parts:
            if part.startswith("--"):
                # Store previous parameter if exists
                if current_param:
                    try:
                        if current_param in MULTI_VALUE_PARAMS:
                            # Handle multi-value parameters
                            values = (
                                [
                                    convert_parameter_value(current_param, v)
                                    for v in current_values
                                ]
                                if current_values
                                else [True]
                            )
                            if current_param in result:
                                result[current_param].extend(values)
                            else:
                                result[current_param] = values
                        else:
                            # Handle single value parameters
>                           value = convert_parameter_value(
                                current_param, current_values[0] if current_values else None
                            )

src/midjargon/core/parameters.py:182: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

param = 'style', value = 'raw photo'

    def convert_parameter_value(param: str, value: str | None) -> Any:
        """Convert a parameter value to the appropriate type."""
        # Handle flag parameters
        if param in FLAG_PARAMS:
            return True if value is None else value.lower() == "true"
    
        # Handle empty values
        if value is None:
            return None
    
        # Handle string parameters
        if param in STRING_PARAMS:
            return str(value)
    
        # Handle version parameter
        if param == "version":
            try:
                return MidjourneyVersion(value)
            except ValueError:
                msg = f"Invalid version value: {value}"
                raise ValueError(msg)
    
        # Handle integer parameters
        if param in INT_PARAMS:
            try:
                return int(value)
            except ValueError:
                msg = f"Invalid integer value for {param}: {value}"
                raise ValueError(msg)
    
        # Handle float parameters
        if param in {
            "stylize",
            "chaos",
            "weird",
            "quality",
            "character_weight",
            "style_weight",
            "image_weight",
            "stop",
        }:
            try:
                return float(value)
            except ValueError:
                msg = f"Invalid numeric value for {param}: {value}"
                raise ValueError(msg)
    
        # Handle style parameter
        if param == "style":
            try:
                return StyleMode(value)
            except ValueError:
                msg = f"Invalid style value: {value}"
>               raise ValueError(msg)
E               ValueError: Invalid style value: raw photo

src/midjargon/core/parameters.py:122: ValueError

During handling of the above exception, another exception occurred:

    def test_parameter_with_spaces():
        """Test parsing parameters with values containing spaces."""
        param_str = '--style "raw photo" --seed 123456'
>       params = parse_parameters(param_str)

tests/core/test_parameters.py:36: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

param_str = '--style "raw photo" --seed 123456'

    def parse_parameters(param_str: str) -> dict[str, Any]:
        """Parse parameters from a string into a dictionary."""
        if not param_str:
            return {}
    
        # Split parameters while preserving quoted strings
        try:
            parts = shlex.split(param_str)
        except ValueError as e:
            msg = f"Failed to parse parameters: {e}"
            raise ValueError(msg)
    
        result: dict[str, Any] = {}
        current_param = None
        current_values = []
    
        for part in parts:
            if part.startswith("--"):
                # Store previous parameter if exists
                if current_param:
                    try:
                        if current_param in MULTI_VALUE_PARAMS:
                            # Handle multi-value parameters
                            values = (
                                [
                                    convert_parameter_value(current_param, v)
                                    for v in current_values
                                ]
                                if current_values
                                else [True]
                            )
                            if current_param in result:
                                result[current_param].extend(values)
                            else:
                                result[current_param] = values
                        else:
                            # Handle single value parameters
                            value = convert_parameter_value(
                                current_param, current_values[0] if current_values else None
                            )
                            result[current_param] = value
                    except Exception as e:
                        msg = f"Failed to parse parameter {current_param}: {e}"
>                       raise ValueError(msg)
E                       ValueError: Failed to parse parameter style: Invalid style value: raw photo

src/midjargon/core/parameters.py:188: ValueError
____________________________ test_mixed_parameters _____________________________

param = 'style', value = 'raw photo'

    def convert_parameter_value(param: str, value: str | None) -> Any:
        """Convert a parameter value to the appropriate type."""
        # Handle flag parameters
        if param in FLAG_PARAMS:
            return True if value is None else value.lower() == "true"
    
        # Handle empty values
        if value is None:
            return None
    
        # Handle string parameters
        if param in STRING_PARAMS:
            return str(value)
    
        # Handle version parameter
        if param == "version":
            try:
                return MidjourneyVersion(value)
            except ValueError:
                msg = f"Invalid version value: {value}"
                raise ValueError(msg)
    
        # Handle integer parameters
        if param in INT_PARAMS:
            try:
                return int(value)
            except ValueError:
                msg = f"Invalid integer value for {param}: {value}"
                raise ValueError(msg)
    
        # Handle float parameters
        if param in {
            "stylize",
            "chaos",
            "weird",
            "quality",
            "character_weight",
            "style_weight",
            "image_weight",
            "stop",
        }:
            try:
                return float(value)
            except ValueError:
                msg = f"Invalid numeric value for {param}: {value}"
                raise ValueError(msg)
    
        # Handle style parameter
        if param == "style":
            try:
>               return StyleMode(value)

src/midjargon/core/parameters.py:119: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/enum.py:751: in __call__
    return cls.__new__(cls, value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <enum 'StyleMode'>, value = 'raw photo'

    def __new__(cls, value):
        # all enum instances are actually created during class construction
        # without calling this method; this method is called by the metaclass'
        # __call__ (i.e. Color(3) ), and by pickle
        if type(value) is cls:
            # For lookups like Color(Color.RED)
            return value
        # by-value search for a matching enum member
        # see if it's in the reverse mapping (for hashable values)
        try:
            return cls._value2member_map_[value]
        except KeyError:
            # Not found, no need to do long O(n) search
            pass
        except TypeError:
            # not there, now do long search -- O(n) behavior
            for member in cls._member_map_.values():
                if member._value_ == value:
                    return member
        # still not found -- verify that members exist, in-case somebody got here mistakenly
        # (such as via super when trying to override __new__)
        if not cls._member_map_:
            raise TypeError("%r has no members defined" % cls)
        #
        # still not found -- try _missing_ hook
        try:
            exc = None
            result = cls._missing_(value)
        except Exception as e:
            exc = e
            result = None
        try:
            if isinstance(result, cls):
                return result
            elif (
                    Flag is not None and issubclass(cls, Flag)
                    and cls._boundary_ is EJECT and isinstance(result, int)
                ):
                return result
            else:
                ve_exc = ValueError("%r is not a valid %s" % (value, cls.__qualname__))
                if result is None and exc is None:
>                   raise ve_exc
E                   ValueError: 'raw photo' is not a valid StyleMode

/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/enum.py:1165: ValueError

During handling of the above exception, another exception occurred:

param_str = '--ar 16:9 --tile --no blur,cars --style "raw photo"'

    def parse_parameters(param_str: str) -> dict[str, Any]:
        """Parse parameters from a string into a dictionary."""
        if not param_str:
            return {}
    
        # Split parameters while preserving quoted strings
        try:
            parts = shlex.split(param_str)
        except ValueError as e:
            msg = f"Failed to parse parameters: {e}"
            raise ValueError(msg)
    
        result: dict[str, Any] = {}
        current_param = None
        current_values = []
    
        for part in parts:
            if part.startswith("--"):
                # Store previous parameter if exists
                if current_param:
                    try:
                        if current_param in MULTI_VALUE_PARAMS:
                            # Handle multi-value parameters
                            values = (
                                [
                                    convert_parameter_value(current_param, v)
                                    for v in current_values
                                ]
                                if current_values
                                else [True]
                            )
                            if current_param in result:
                                result[current_param].extend(values)
                            else:
                                result[current_param] = values
                        else:
                            # Handle single value parameters
                            value = convert_parameter_value(
                                current_param, current_values[0] if current_values else None
                            )
                            result[current_param] = value
                    except Exception as e:
                        msg = f"Failed to parse parameter {current_param}: {e}"
                        raise ValueError(msg)
    
                # Start new parameter
                current_param = ALIASES.get(
                    part[2:], part[2:]
                )  # Remove -- and resolve alias
                current_values = []
            elif current_param:
                current_values.append(part)
            else:
                msg = f"Unexpected value without parameter: {part}"
                raise ValueError(msg)
    
        # Handle last parameter
        if current_param:
            try:
                if current_param in MULTI_VALUE_PARAMS:
                    values = (
                        [convert_parameter_value(current_param, v) for v in current_values]
                        if current_values
                        else [True]
                    )
                    if current_param in result:
                        result[current_param].extend(values)
                    else:
                        result[current_param] = values
                else:
>                   value = convert_parameter_value(
                        current_param, current_values[0] if current_values else None
                    )

src/midjargon/core/parameters.py:215: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

param = 'style', value = 'raw photo'

    def convert_parameter_value(param: str, value: str | None) -> Any:
        """Convert a parameter value to the appropriate type."""
        # Handle flag parameters
        if param in FLAG_PARAMS:
            return True if value is None else value.lower() == "true"
    
        # Handle empty values
        if value is None:
            return None
    
        # Handle string parameters
        if param in STRING_PARAMS:
            return str(value)
    
        # Handle version parameter
        if param == "version":
            try:
                return MidjourneyVersion(value)
            except ValueError:
                msg = f"Invalid version value: {value}"
                raise ValueError(msg)
    
        # Handle integer parameters
        if param in INT_PARAMS:
            try:
                return int(value)
            except ValueError:
                msg = f"Invalid integer value for {param}: {value}"
                raise ValueError(msg)
    
        # Handle float parameters
        if param in {
            "stylize",
            "chaos",
            "weird",
            "quality",
            "character_weight",
            "style_weight",
            "image_weight",
            "stop",
        }:
            try:
                return float(value)
            except ValueError:
                msg = f"Invalid numeric value for {param}: {value}"
                raise ValueError(msg)
    
        # Handle style parameter
        if param == "style":
            try:
                return StyleMode(value)
            except ValueError:
                msg = f"Invalid style value: {value}"
>               raise ValueError(msg)
E               ValueError: Invalid style value: raw photo

src/midjargon/core/parameters.py:122: ValueError

During handling of the above exception, another exception occurred:

    def test_mixed_parameters():
        """Test parsing a mix of different parameter types."""
        param_str = '--ar 16:9 --tile --no blur,cars --style "raw photo"'
>       params = parse_parameters(param_str)

tests/core/test_parameters.py:44: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

param_str = '--ar 16:9 --tile --no blur,cars --style "raw photo"'

    def parse_parameters(param_str: str) -> dict[str, Any]:
        """Parse parameters from a string into a dictionary."""
        if not param_str:
            return {}
    
        # Split parameters while preserving quoted strings
        try:
            parts = shlex.split(param_str)
        except ValueError as e:
            msg = f"Failed to parse parameters: {e}"
            raise ValueError(msg)
    
        result: dict[str, Any] = {}
        current_param = None
        current_values = []
    
        for part in parts:
            if part.startswith("--"):
                # Store previous parameter if exists
                if current_param:
                    try:
                        if current_param in MULTI_VALUE_PARAMS:
                            # Handle multi-value parameters
                            values = (
                                [
                                    convert_parameter_value(current_param, v)
                                    for v in current_values
                                ]
                                if current_values
                                else [True]
                            )
                            if current_param in result:
                                result[current_param].extend(values)
                            else:
                                result[current_param] = values
                        else:
                            # Handle single value parameters
                            value = convert_parameter_value(
                                current_param, current_values[0] if current_values else None
                            )
                            result[current_param] = value
                    except Exception as e:
                        msg = f"Failed to parse parameter {current_param}: {e}"
                        raise ValueError(msg)
    
                # Start new parameter
                current_param = ALIASES.get(
                    part[2:], part[2:]
                )  # Remove -- and resolve alias
                current_values = []
            elif current_param:
                current_values.append(part)
            else:
                msg = f"Unexpected value without parameter: {part}"
                raise ValueError(msg)
    
        # Handle last parameter
        if current_param:
            try:
                if current_param in MULTI_VALUE_PARAMS:
                    values = (
                        [convert_parameter_value(current_param, v) for v in current_values]
                        if current_values
                        else [True]
                    )
                    if current_param in result:
                        result[current_param].extend(values)
                    else:
                        result[current_param] = values
                else:
                    value = convert_parameter_value(
                        current_param, current_values[0] if current_values else None
                    )
                    result[current_param] = value
            except Exception as e:
                msg = f"Failed to parse parameter {current_param}: {e}"
>               raise ValueError(msg)
E               ValueError: Failed to parse parameter style: Invalid style value: raw photo

src/midjargon/core/parameters.py:221: ValueError
__________________________ test_shorthand_parameters ___________________________

    def test_shorthand_parameters():
        """Test parsing of shorthand parameter names."""
        param_str = "--s 100 --c 50 --w 1000 --iw 2.0 --q 1.0"
        params = parse_parameters(param_str)
>       assert params["stylize"] == "100"
E       AssertionError: assert 100.0 == '100'

tests/core/test_parameters.py:55: AssertionError
_________________________ test_niji_version_parameter __________________________

    def test_niji_version_parameter():
        """Test parsing of niji version parameter."""
        # Test basic niji
        params = parse_parameters("--niji")
>       assert params["version"] == "niji"
E       AssertionError: assert None == 'niji'

tests/core/test_parameters.py:66: AssertionError
____________________________ test_version_parameter ____________________________

    def test_version_parameter():
        """Test parsing of version parameter."""
        # Test v parameter
        params = parse_parameters("--v 5.2")
>       assert params["version"] == "5.2"
E       AssertionError: assert <MidjourneyVe....V5_2: 'v5.2'> == '5.2'
E         
E         - 5.2
E         + v5.2
E         ? +

tests/core/test_parameters.py:77: AssertionError
________________________ test_personalization_parameter ________________________

    def test_personalization_parameter():
        """Test parsing of personalization parameter."""
        # Test basic p parameter
        params = parse_parameters("--p")
>       assert params["personalization"] is None  # Flag without value is None
E       assert True is None

tests/core/test_parameters.py:84: AssertionError
__________________________ test_reference_parameters ___________________________

    def test_reference_parameters():
        """Test parsing of reference parameters."""
        param_str = "--cref img1.jpg img2.jpg --sref style1.jpg style2.jpg"
        params = parse_parameters(param_str)
>       assert params["character_reference"] == ["img1.jpg", "img2.jpg"]
E       AssertionError: assert [CharacterRef...e='img2.jpg')] == ['img1.jpg', 'img2.jpg']
E         
E         At index 0 diff: CharacterReference(url=HttpUrl('https://example.com/img1.jpg'), weight=1.0, code='img1.jpg') != 'img1.jpg'
E         
E         Full diff:
E           [
E         -     'img1.jpg',
E         -     'img2.jpg',...
E         
E         ...Full output truncated (3 lines hidden), use '-vv' to show

tests/core/test_parameters.py:107: AssertionError
___________________________ test_invalid_parameters ____________________________

    def test_invalid_parameters():
        """Test handling of invalid parameter formats."""
>       with pytest.raises(ValueError, match="Empty parameter name"):
E       Failed: DID NOT RAISE <class 'ValueError'>

tests/core/test_parameters.py:121: Failed
____________________________ test_parse_parameters _____________________________

    def test_parse_parameters():
        """Test parse_parameters function to verify parameter parsing."""
        param_str = "--ar 16:9 --stylize 100"
        params = parse_parameters(param_str)
        assert params["aspect"] == "16:9"
>       assert params["stylize"] == "100"
E       AssertionError: assert 100.0 == '100'

tests/core/test_parameters.py:139: AssertionError
________________________ test_flag_parameters_handling _________________________

    def test_flag_parameters_handling():
        """Test handling of flag parameters in parse_parameters."""
        param_str = "--tile --turbo --relax --video --remix"
        params = parse_parameters(param_str)
>       assert params["tile"] is None
E       assert True is None

tests/core/test_parameters.py:216: AssertionError
___________________________ test_special_seed_values ___________________________

param = 'seed', value = 'random'

    def convert_parameter_value(param: str, value: str | None) -> Any:
        """Convert a parameter value to the appropriate type."""
        # Handle flag parameters
        if param in FLAG_PARAMS:
            return True if value is None else value.lower() == "true"
    
        # Handle empty values
        if value is None:
            return None
    
        # Handle string parameters
        if param in STRING_PARAMS:
            return str(value)
    
        # Handle version parameter
        if param == "version":
            try:
                return MidjourneyVersion(value)
            except ValueError:
                msg = f"Invalid version value: {value}"
                raise ValueError(msg)
    
        # Handle integer parameters
        if param in INT_PARAMS:
            try:
>               return int(value)
E               ValueError: invalid literal for int() with base 10: 'random'

src/midjargon/core/parameters.py:94: ValueError

During handling of the above exception, another exception occurred:

param_str = '--seed random'

    def parse_parameters(param_str: str) -> dict[str, Any]:
        """Parse parameters from a string into a dictionary."""
        if not param_str:
            return {}
    
        # Split parameters while preserving quoted strings
        try:
            parts = shlex.split(param_str)
        except ValueError as e:
            msg = f"Failed to parse parameters: {e}"
            raise ValueError(msg)
    
        result: dict[str, Any] = {}
        current_param = None
        current_values = []
    
        for part in parts:
            if part.startswith("--"):
                # Store previous parameter if exists
                if current_param:
                    try:
                        if current_param in MULTI_VALUE_PARAMS:
                            # Handle multi-value parameters
                            values = (
                                [
                                    convert_parameter_value(current_param, v)
                                    for v in current_values
                                ]
                                if current_values
                                else [True]
                            )
                            if current_param in result:
                                result[current_param].extend(values)
                            else:
                                result[current_param] = values
                        else:
                            # Handle single value parameters
                            value = convert_parameter_value(
                                current_param, current_values[0] if current_values else None
                            )
                            result[current_param] = value
                    except Exception as e:
                        msg = f"Failed to parse parameter {current_param}: {e}"
                        raise ValueError(msg)
    
                # Start new parameter
                current_param = ALIASES.get(
                    part[2:], part[2:]
                )  # Remove -- and resolve alias
                current_values = []
            elif current_param:
                current_values.append(part)
            else:
                msg = f"Unexpected value without parameter: {part}"
                raise ValueError(msg)
    
        # Handle last parameter
        if current_param:
            try:
                if current_param in MULTI_VALUE_PARAMS:
                    values = (
                        [convert_parameter_value(current_param, v) for v in current_values]
                        if current_values
                        else [True]
                    )
                    if current_param in result:
                        result[current_param].extend(values)
                    else:
                        result[current_param] = values
                else:
>                   value = convert_parameter_value(
                        current_param, current_values[0] if current_values else None
                    )

src/midjargon/core/parameters.py:215: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

param = 'seed', value = 'random'

    def convert_parameter_value(param: str, value: str | None) -> Any:
        """Convert a parameter value to the appropriate type."""
        # Handle flag parameters
        if param in FLAG_PARAMS:
            return True if value is None else value.lower() == "true"
    
        # Handle empty values
        if value is None:
            return None
    
        # Handle string parameters
        if param in STRING_PARAMS:
            return str(value)
    
        # Handle version parameter
        if param == "version":
            try:
                return MidjourneyVersion(value)
            except ValueError:
                msg = f"Invalid version value: {value}"
                raise ValueError(msg)
    
        # Handle integer parameters
        if param in INT_PARAMS:
            try:
                return int(value)
            except ValueError:
                msg = f"Invalid integer value for {param}: {value}"
>               raise ValueError(msg)
E               ValueError: Invalid integer value for seed: random

src/midjargon/core/parameters.py:97: ValueError

During handling of the above exception, another exception occurred:

    def test_special_seed_values():
        """Test handling of special seed values."""
        # Test random seed
>       params = parse_parameters("--seed random")

tests/core/test_parameters.py:238: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

param_str = '--seed random'

    def parse_parameters(param_str: str) -> dict[str, Any]:
        """Parse parameters from a string into a dictionary."""
        if not param_str:
            return {}
    
        # Split parameters while preserving quoted strings
        try:
            parts = shlex.split(param_str)
        except ValueError as e:
            msg = f"Failed to parse parameters: {e}"
            raise ValueError(msg)
    
        result: dict[str, Any] = {}
        current_param = None
        current_values = []
    
        for part in parts:
            if part.startswith("--"):
                # Store previous parameter if exists
                if current_param:
                    try:
                        if current_param in MULTI_VALUE_PARAMS:
                            # Handle multi-value parameters
                            values = (
                                [
                                    convert_parameter_value(current_param, v)
                                    for v in current_values
                                ]
                                if current_values
                                else [True]
                            )
                            if current_param in result:
                                result[current_param].extend(values)
                            else:
                                result[current_param] = values
                        else:
                            # Handle single value parameters
                            value = convert_parameter_value(
                                current_param, current_values[0] if current_values else None
                            )
                            result[current_param] = value
                    except Exception as e:
                        msg = f"Failed to parse parameter {current_param}: {e}"
                        raise ValueError(msg)
    
                # Start new parameter
                current_param = ALIASES.get(
                    part[2:], part[2:]
                )  # Remove -- and resolve alias
                current_values = []
            elif current_param:
                current_values.append(part)
            else:
                msg = f"Unexpected value without parameter: {part}"
                raise ValueError(msg)
    
        # Handle last parameter
        if current_param:
            try:
                if current_param in MULTI_VALUE_PARAMS:
                    values = (
                        [convert_parameter_value(current_param, v) for v in current_values]
                        if current_values
                        else [True]
                    )
                    if current_param in result:
                        result[current_param].extend(values)
                    else:
                        result[current_param] = values
                else:
                    value = convert_parameter_value(
                        current_param, current_values[0] if current_values else None
                    )
                    result[current_param] = value
            except Exception as e:
                msg = f"Failed to parse parameter {current_param}: {e}"
>               raise ValueError(msg)
E               ValueError: Failed to parse parameter seed: Invalid integer value for seed: random

src/midjargon/core/parameters.py:221: ValueError
_________________________ test_reference_url_handling __________________________

    def test_reference_url_handling():
        """Test handling of URLs in reference parameters."""
        # Test character reference with quoted URL containing spaces
        params = parse_parameters('--cref "https://example.com/image with spaces.jpg"')
>       assert params["character_reference"] == [
            "https://example.com/image with spaces.jpg"
        ]
E       AssertionError: assert [CharacterRef...0, code=None)] == ['https://exa...h spaces.jpg']
E         
E         At index 0 diff: CharacterReference(url=HttpUrl('https://example.com/image%20with%20spaces.jpg'), weight=1.0, code=None) != 'https://example.com/image with spaces.jpg'
E         
E         Full diff:
E           [
E         -     'https://example.com/image with spaces.jpg',
E         +     CharacterReference(url=HttpUrl('https://example.com/image%20with%20spaces.jpg'), weight=1.0, code=None),
E           ]

tests/core/test_parameters.py:250: AssertionError
__________________________ test_niji_version_handling __________________________

    def test_niji_version_handling():
        """Test handling of niji version parameter."""
        # Test basic niji flag
        params = parse_parameters("--niji")
>       assert params["version"] == "niji"
E       AssertionError: assert None == 'niji'

tests/core/test_parameters.py:271: AssertionError
__________________________ test_basic_prompt_parsing ___________________________

    def test_basic_prompt_parsing():
        """Test basic prompt parsing."""
        prompt = "a beautiful landscape --ar 16:9 --stylize 100"
        result = parse_midjargon_prompt_to_dict(prompt)
        assert result["text"] == "a beautiful landscape"
>       assert result["aspect"] == ASPECT_RATIO
E       KeyError: 'aspect'

tests/core/test_parser.py:18: KeyError
__________________________ test_prompt_with_image_url __________________________

    def test_prompt_with_image_url():
        """Test prompt parsing with image URL."""
        prompt = f"{IMAGE_URL} a mystical forest --chaos 50"
        result = parse_midjargon_prompt_to_dict(prompt)
        assert result["text"] == "a mystical forest"
>       assert result["images"] == [IMAGE_URL]
E       AssertionError: assert [HttpUrl('htt...m/image.jpg')] == ['https://exa...om/image.jpg']
E         
E         At index 0 diff: HttpUrl('https://example.com/image.jpg') != 'https://example.com/image.jpg'
E         
E         Full diff:
E           [
E         -     'https://example.com/image.jpg',
E         +     HttpUrl('https://example.com/image.jpg'),
E         ?     ++++++++                               +
E           ]

tests/core/test_parser.py:27: AssertionError
_____________________ test_prompt_with_multiple_image_urls _____________________

    def test_prompt_with_multiple_image_urls():
        """Test prompt parsing with multiple image URLs."""
        image_urls = [
            "https://example.com/image1.jpg",
            "https://example.com/image2.jpg",
        ]
        prompt = f"{image_urls[0]} {image_urls[1]} a serene landscape --stylize 100"
        result = parse_midjargon_prompt_to_dict(prompt)
        assert result["text"] == "a serene landscape"
>       assert result["images"] == image_urls
E       AssertionError: assert [HttpUrl('htt.../image2.jpg')] == ['https://exa...m/image2.jpg']
E         
E         At index 0 diff: HttpUrl('https://example.com/image1.jpg') != 'https://example.com/image1.jpg'
E         
E         Full diff:
E           [
E         -     'https://example.com/image1.jpg',
E         +     HttpUrl('https://example.com/image1.jpg'),...
E         
E         ...Full output truncated (5 lines hidden), use '-vv' to show

tests/core/test_parser.py:40: AssertionError
_________________________ test_prompt_with_parameters __________________________

    def test_prompt_with_parameters():
        """Test prompt parsing with various parameters."""
        prompt = "a futuristic city --ar 16:9 --stylize 100 --chaos 50"
        result = parse_midjargon_prompt_to_dict(prompt)
        assert result["text"] == "a futuristic city"
>       assert result["aspect"] == ASPECT_RATIO
E       KeyError: 'aspect'

tests/core/test_parser.py:49: KeyError
______________________ test_prompt_with_empty_parameters _______________________

    def test_prompt_with_empty_parameters():
        """Test prompt parsing with empty parameters."""
        prompt = "a landscape photo --tile --no blur,cars"
        result = parse_midjargon_prompt_to_dict(prompt)
        assert result["text"] == "a landscape photo"
>       assert result["tile"] is None
E       assert True is None

tests/core/test_parser.py:59: AssertionError
______________________________ test_aspect_ratio _______________________________

    def test_aspect_ratio():
        """Test parsing of aspect ratio."""
        parser = MidjourneyParser()
        prompt = parser.parse_dict({"text": "a photo", "ar": "16:9"})
    
        assert prompt.text == "a photo"
>       assert prompt.aspect_width == 16
E       AssertionError: assert None == 16
E        +  where None = MidjourneyPrompt(text='a photo', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={'ar': '16:9'}, images=[]).aspect_width

tests/engines/midjourney/test_midjourney_parser.py:61: AssertionError
_____________________________ test_invalid_values ______________________________

    def test_invalid_values():
        """Test handling of invalid parameter values."""
        parser = MidjourneyParser()
    
        # Invalid aspect ratio - now accepts any value
        result = parser.parse_dict({"text": "a photo", "ar": "999:999"})
>       assert result.aspect_width == 999
E       AssertionError: assert None == 999
E        +  where None = MidjourneyPrompt(text='a photo', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={'ar': '999:999'}, images=[]).aspect_width

tests/engines/midjourney/test_midjourney_parser.py:120: AssertionError
______________________________ test_empty_values _______________________________

    def test_empty_values():
        """Test handling of empty values."""
        parser = MidjourneyParser()
    
        # Empty text
        with pytest.raises(ValueError, match="Empty prompt"):
            parser.parse_dict({"text": ""})
    
        # Empty image list
        prompt = parser.parse_dict({"text": "a photo", "image_prompts": []})
        assert prompt.text == "a photo"
        assert not prompt.image_prompts
    
        # None values
>       prompt = parser.parse_dict({"text": "a photo", "stylize": None})

tests/engines/midjourney/test_midjourney_parser.py:144: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <midjargon.engines.midjourney.midjourney.MidjourneyParser object at 0x1100d7d10>
prompt_dict = {'stylize': None}

    def parse_dict(self, prompt_dict: dict[str, Any]) -> MidjourneyPrompt:
        """Parse a dictionary into a MidjourneyPrompt.
    
        Args:
            prompt_dict: Dictionary containing prompt data.
    
        Returns:
            MidjourneyPrompt instance.
    
        Raises:
            ValueError: If the prompt text is empty.
        """
        # Validate text
        text = prompt_dict.pop("text", "").strip()
        if not text:
            msg = "Empty prompt"
            raise ValueError(msg)
    
        # Extract known fields
        known_fields = set(MidjourneyPrompt.model_fields)
    
        # Split into known and extra parameters
        params = {}
        extra_params = {}
        for key, value in prompt_dict.items():
            if key in known_fields:
                params[key] = value
            else:
                extra_params[key] = value
    
        # Create prompt with all parameters
>       return MidjourneyPrompt(text=text, **params, extra_params=extra_params)
E       pydantic_core._pydantic_core.ValidationError: 1 validation error for MidjourneyPrompt
E       stylize
E         Input should be a valid number [type=float_type, input_value=None, input_type=NoneType]
E           For further information visit https://errors.pydantic.dev/2.10/v/float_type

src/midjargon/engines/midjourney/midjourney.py:46: ValidationError
_____________________________ test_basic_workflow ______________________________

prompt = 'a beautiful landscape --ar 16:9 --stylize 100 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_basic_workflow():
        """Test basic prompt workflow without permutations."""
        prompt = f"a beautiful landscape --ar {ASPECT_WIDTH}:{ASPECT_HEIGHT} --stylize {STYLIZE_VALUE}"
>       results = process_prompt(prompt)

tests/integration/test_workflow.py:52: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_workflow.py:41: in process_prompt
    parse_midjargon_prompt_to_dict(variant.prompt.to_string())
src/midjargon/core/parser.py:172: in parse_midjargon_prompt_to_dict
    parsed = parse_midjargon_prompt(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = 'a beautiful landscape --ar 16:9 --stylize 100 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError
__________________________ test_permutation_workflow ___________________________

prompt = 'a red bird on a branch --stylize 100 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_permutation_workflow():
        """Test workflow with permutations."""
        prompt = f"a {{red, blue}} bird on a {{branch, rock}} --stylize {STYLIZE_VALUE}"
>       results = process_prompt(prompt)

tests/integration/test_workflow.py:66: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_workflow.py:41: in process_prompt
    parse_midjargon_prompt_to_dict(variant.prompt.to_string())
src/midjargon/core/parser.py:172: in parse_midjargon_prompt_to_dict
    parsed = parse_midjargon_prompt(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = 'a red bird on a branch --stylize 100 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError
_____________________________ test_image_workflow ______________________________

prompt = 'https://example.com/image1.jpg https://example.com/image2.jpg abstract fusion --iw 2.0 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_image_workflow():
        """Test workflow with image URLs."""
        urls = [
            "https://example.com/image1.jpg",
            "https://example.com/image2.jpg",
        ]
        prompt = f"{' '.join(urls)} abstract fusion --iw {IMAGE_WEIGHT_VALUE}"
>       results = process_prompt(prompt)

tests/integration/test_workflow.py:87: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_workflow.py:41: in process_prompt
    parse_midjargon_prompt_to_dict(variant.prompt.to_string())
src/midjargon/core/parser.py:172: in parse_midjargon_prompt_to_dict
    parsed = parse_midjargon_prompt(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = 'https://example.com/image1.jpg https://example.com/image2.jpg abstract fusion --iw 2.0 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError
___________________________ test_parameter_workflow ____________________________

prompt = 'cyberpunk city --v 5.2 --style raw --chaos 50 --weird 1000 --seed 12345 --stop 80 --turbo --tile --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_parameter_workflow():
        """Test workflow with various parameter types."""
        prompt = (
            "cyberpunk city --v 5.2 --style raw "
            f"--chaos {CHAOS_VALUE} --weird {WEIRD_VALUE} "
            f"--seed {SEED_VALUE} --stop {STOP_VALUE} "
            "--turbo --tile"
        )
>       results = process_prompt(prompt)

tests/integration/test_workflow.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_workflow.py:41: in process_prompt
    parse_midjargon_prompt_to_dict(variant.prompt.to_string())
src/midjargon/core/parser.py:172: in parse_midjargon_prompt_to_dict
    parsed = parse_midjargon_prompt(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = 'cyberpunk city --v 5.2 --style raw --chaos 50 --weird 1000 --seed 12345 --stop 80 --turbo --tile --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError
_________________________ test_new_parameters_workflow _________________________

prompt = 'portrait photo --quality 1.0 --cw 100 --sw 200 --sv 2 --repeat 3 --cref ref1.jpg ref2.jpg --sref style1.jpg style2.jp... --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_new_parameters_workflow():
        """Test workflow with new parameter types."""
        prompt = (
            "portrait photo "
            f"--quality {QUALITY_VALUE} "
            f"--cw {CHARACTER_WEIGHT_VALUE} "
            f"--sw {STYLE_WEIGHT_VALUE} "
            f"--sv {STYLE_VERSION_VALUE} "
            f"--repeat {REPEAT_VALUE} "
            "--cref ref1.jpg ref2.jpg "
            "--sref style1.jpg style2.jpg "
            "--p custom_profile1 custom_profile2"
        )
>       results = process_prompt(prompt)

tests/integration/test_workflow.py:135: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_workflow.py:41: in process_prompt
    parse_midjargon_prompt_to_dict(variant.prompt.to_string())
src/midjargon/core/parser.py:172: in parse_midjargon_prompt_to_dict
    parsed = parse_midjargon_prompt(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = 'portrait photo --quality 1.0 --cw 100 --sw 200 --sv 2 --repeat 3 --cref ref1.jpg ref2.jpg --sref style1.jpg style2.jp... --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError
________________________ test_weighted_prompts_workflow ________________________

prompt = 'cyberpunk city::2 neon lights::1 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_weighted_prompts_workflow():
        """Test workflow with weighted prompts."""
        prompt = "cyberpunk city::2 neon lights::1"
>       results = process_prompt(prompt)

tests/integration/test_workflow.py:154: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_workflow.py:41: in process_prompt
    parse_midjargon_prompt_to_dict(variant.prompt.to_string())
src/midjargon/core/parser.py:172: in parse_midjargon_prompt_to_dict
    parsed = parse_midjargon_prompt(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = 'cyberpunk city::2 neon lights::1 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError
_____________________________ test_error_workflow ______________________________

prompt = ' --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_error_workflow():
        """Test error handling in workflow."""
        # Test empty prompt
        with pytest.raises(ValueError, match="Empty prompt"):
>           process_prompt("")

tests/integration/test_workflow.py:165: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_workflow.py:41: in process_prompt
    parse_midjargon_prompt_to_dict(variant.prompt.to_string())
src/midjargon/core/parser.py:172: in parse_midjargon_prompt_to_dict
    parsed = parse_midjargon_prompt(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = ' --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError

During handling of the above exception, another exception occurred:

    def test_error_workflow():
        """Test error handling in workflow."""
        # Test empty prompt
>       with pytest.raises(ValueError, match="Empty prompt"):
E       AssertionError: Regex pattern did not match.
E        Regex: 'Empty prompt'
E        Input: "Failed to create prompt object: 2 validation errors for MidjourneyPrompt\ncharacter_reference\n  Input should be a valid list [type=list_type, input_value='[]', input_type=str]\n    For further information visit https://errors.pydantic.dev/2.10/v/list_type\nstyle_reference\n  Input should be a valid list [type=list_type, input_value='[]', input_type=str]\n    For further information visit https://errors.pydantic.dev/2.10/v/list_type"

tests/integration/test_workflow.py:164: AssertionError
____________________________ test_complex_workflow _____________________________

prompt = 'https://example.com/img1.jpg https://example.com/img2.jpg a vintage portrait with warm tones --ar 16:9 --stylize 100 ... --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_complex_workflow():
        """Test workflow with multiple features combined."""
        prompt = (
            "https://example.com/img1.jpg https://example.com/img2.jpg "
            "a {vintage, modern} {portrait, landscape} "
            "with {warm, cool} tones "
            f"--ar {ASPECT_WIDTH}:{ASPECT_HEIGHT} --stylize {STYLIZE_VALUE} "
            f"--chaos {CHAOS_VALUE} --v 5.2 --style raw "
            f"--quality {QUALITY_VALUE} --cw {CHARACTER_WEIGHT_VALUE} "
            "--turbo"
        )
>       results = process_prompt(prompt)

tests/integration/test_workflow.py:193: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_workflow.py:41: in process_prompt
    parse_midjargon_prompt_to_dict(variant.prompt.to_string())
src/midjargon/core/parser.py:172: in parse_midjargon_prompt_to_dict
    parsed = parse_midjargon_prompt(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = 'https://example.com/img1.jpg https://example.com/img2.jpg a vintage portrait with warm tones --ar 16:9 --stylize 100 ... --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError
______________________ test_permutations_with_parameters _______________________

prompt = 'smooth edges  --s 75 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_permutations_with_parameters():
        """Test permutations with parameters are handled correctly."""
        prompt = "smooth edges {, --p} --s {75, 300}"
>       results = process_prompt(prompt)

tests/integration/test_workflow.py:219: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_workflow.py:41: in process_prompt
    parse_midjargon_prompt_to_dict(variant.prompt.to_string())
src/midjargon/core/parser.py:172: in parse_midjargon_prompt_to_dict
    parsed = parse_midjargon_prompt(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = 'smooth edges  --s 75 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError
____________________ test_permutations_with_flag_parameters ____________________

prompt = 'photo   --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_permutations_with_flag_parameters():
        """Test permutations with flag parameters (no value) are handled correctly."""
        prompt = "photo {, --tile} {, --turbo}"
>       results = process_prompt(prompt)

tests/integration/test_workflow.py:242: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_workflow.py:41: in process_prompt
    parse_midjargon_prompt_to_dict(variant.prompt.to_string())
src/midjargon/core/parser.py:172: in parse_midjargon_prompt_to_dict
    parsed = parse_midjargon_prompt(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = 'photo   --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError
__________________ test_permutations_with_complex_parameters ___________________

prompt = 'portrait modern  --ar 1:1 --s 100 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_permutations_with_complex_parameters():
        """Test permutations with complex parameter combinations."""
        prompt = "portrait {modern, vintage} {, --p custom} --ar {1:1, 16:9} --s 100"
>       results = process_prompt(prompt)

tests/integration/test_workflow.py:263: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/integration/test_workflow.py:41: in process_prompt
    parse_midjargon_prompt_to_dict(variant.prompt.to_string())
src/midjargon/core/parser.py:172: in parse_midjargon_prompt_to_dict
    parsed = parse_midjargon_prompt(prompt)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = 'portrait modern  --ar 1:1 --s 100 --stylize 100 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError
_____________________________ test_cli_mj_command ______________________________

self = <midjargon.cli.main.MidjargonCLI object at 0x110076270>
prompt = 'a serene landscape --ar 16:9 --stylize 100', json_output = True
no_color = False

    def mj(
        self, prompt: str, json_output: bool = False, no_color: bool = False
    ) -> None:
        """Convert a prompt to Midjourney format.
    
        Args:
            prompt: The prompt to convert.
            json_output: Whether to output JSON.
            no_color: Whether to disable colored output.
        """
        try:
            variants = expand_midjargon_input(prompt)
            parser = MidjourneyParser()
            results = []
            for variant in variants:
>               mj_prompt = parser.parse_dict(variant.prompt.model_dump())

src/midjargon/cli/main.py:68: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <midjargon.engines.midjourney.midjourney.MidjourneyParser object at 0x110076fc0>
prompt_dict = {'aspect_height': None, 'aspect_ratio': None, 'aspect_width': None, 'chaos': 0, ...}

    def parse_dict(self, prompt_dict: dict[str, Any]) -> MidjourneyPrompt:
        """Parse a dictionary into a MidjourneyPrompt.
    
        Args:
            prompt_dict: Dictionary containing prompt data.
    
        Returns:
            MidjourneyPrompt instance.
    
        Raises:
            ValueError: If the prompt text is empty.
        """
        # Validate text
        text = prompt_dict.pop("text", "").strip()
        if not text:
            msg = "Empty prompt"
            raise ValueError(msg)
    
        # Extract known fields
        known_fields = set(MidjourneyPrompt.model_fields)
    
        # Split into known and extra parameters
        params = {}
        extra_params = {}
        for key, value in prompt_dict.items():
            if key in known_fields:
                params[key] = value
            else:
                extra_params[key] = value
    
        # Create prompt with all parameters
>       return MidjourneyPrompt(text=text, **params, extra_params=extra_params)
E       TypeError: midjargon.core.models.MidjourneyPrompt() got multiple values for keyword argument 'extra_params'

src/midjargon/engines/midjourney/midjourney.py:46: TypeError

During handling of the above exception, another exception occurred:

    def test_cli_mj_command():
        """Test Midjourney prompt conversion using CLI."""
        cli = MidjargonCLI()
        prompt = "a serene landscape --ar 16:9 --stylize 100"
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.mj(prompt, json_output=True)

tests/integration/test_workflow.py:300: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <midjargon.cli.main.MidjargonCLI object at 0x110076270>
prompt = 'a serene landscape --ar 16:9 --stylize 100', json_output = True
no_color = False

    def mj(
        self, prompt: str, json_output: bool = False, no_color: bool = False
    ) -> None:
        """Convert a prompt to Midjourney format.
    
        Args:
            prompt: The prompt to convert.
            json_output: Whether to output JSON.
            no_color: Whether to disable colored output.
        """
        try:
            variants = expand_midjargon_input(prompt)
            parser = MidjourneyParser()
            results = []
            for variant in variants:
                mj_prompt = parser.parse_dict(variant.prompt.model_dump())
                results.append(mj_prompt.model_dump())
    
            if json_output:
                pass
            else:
                for i, result in enumerate(results):
                    if len(results) > 1:
                        console.print(f"{i + 1}. ", end="", highlight=not no_color)
                    params = " ".join(
                        f"--{k} {v}"
                        for k, v in result.items()
                        if k not in {"text", "image_prompts", "extra_params"}
                        and v is not None
                    )
                    console.print(
                        f"{result['text']} {params}",
                        highlight=not no_color,
                    )
        except Exception as e:
            error_console.print(f"[red]Error:[/red] {e!s}", highlight=not no_color)
>           sys.exit(1)
E           SystemExit: 1

src/midjargon/cli/main.py:89: SystemExit
----------------------------- Captured stderr call -----------------------------
Error: midjargon.core.models.MidjourneyPrompt() got multiple values for keyword 
argument 'extra_params'
_____________________________ test_cli_fal_command _____________________________

self = <midjargon.cli.main.MidjargonCLI object at 0x110076d80>
prompt = 'a serene landscape --ar 16:9 --stylize 100', json_output = True
no_color = False

    def fal(
        self, prompt: str, json_output: bool = False, no_color: bool = False
    ) -> None:
        """Convert a prompt to Fal.ai format.
    
        Args:
            prompt: The prompt to convert.
            json_output: Whether to output JSON.
            no_color: Whether to disable colored output.
        """
        try:
            variants = expand_midjargon_input(prompt)
            parser = FalParser()
            results = []
            for variant in variants:
>               fal_prompt = parser.parse_dict(variant.prompt.model_dump())

src/midjargon/cli/main.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <midjargon.engines.fal.fal.FalParser object at 0x1100764e0>
prompt_dict = {'aspect_height': None, 'aspect_ratio': None, 'aspect_width': None, 'chaos': 0, ...}

    def parse_dict(self, prompt_dict: dict[str, Any]) -> FalPrompt:
        """Parse a dictionary into a FalPrompt.
    
        Args:
            prompt_dict: Dictionary containing prompt data.
    
        Returns:
            FalPrompt instance.
    
        Raises:
            ValueError: If the prompt text is empty.
        """
        # Validate text
        text = prompt_dict.pop("text", "").strip()
        if not text:
            msg = "Empty prompt"
            raise ValueError(msg)
    
        # Extract known fields
        known_fields = set(FalPrompt.model_fields)
    
        # Split into known and extra parameters
        params = {}
        extra_params = {}
        for key, value in prompt_dict.items():
            if key in known_fields:
                params[key] = value
            else:
                extra_params[key] = value
    
        # Create prompt with all parameters
>       return FalPrompt(text=text, **params, extra_params=extra_params)
E       TypeError: midjargon.engines.fal.fal.FalPrompt() got multiple values for keyword argument 'extra_params'

src/midjargon/engines/fal/fal.py:102: TypeError

During handling of the above exception, another exception occurred:

    def test_cli_fal_command():
        """Test Fal.ai prompt conversion using CLI."""
        cli = MidjargonCLI()
        prompt = "a serene landscape --ar 16:9 --stylize 100"
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
>           cli.fal(prompt, json_output=True)

tests/integration/test_workflow.py:315: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <midjargon.cli.main.MidjargonCLI object at 0x110076d80>
prompt = 'a serene landscape --ar 16:9 --stylize 100', json_output = True
no_color = False

    def fal(
        self, prompt: str, json_output: bool = False, no_color: bool = False
    ) -> None:
        """Convert a prompt to Fal.ai format.
    
        Args:
            prompt: The prompt to convert.
            json_output: Whether to output JSON.
            no_color: Whether to disable colored output.
        """
        try:
            variants = expand_midjargon_input(prompt)
            parser = FalParser()
            results = []
            for variant in variants:
                fal_prompt = parser.parse_dict(variant.prompt.model_dump())
                results.append(fal_prompt.model_dump())
    
            if json_output:
                pass
            else:
                for i, result in enumerate(results):
                    if len(results) > 1:
                        console.print(f"{i + 1}. ", end="", highlight=not no_color)
                    console.print(
                        result["text"],
                        highlight=not no_color,
                    )
        except Exception as e:
            error_console.print(f"[red]Error:[/red] {e!s}", highlight=not no_color)
>           sys.exit(1)
E           SystemExit: 1

src/midjargon/cli/main.py:121: SystemExit
----------------------------- Captured stderr call -----------------------------
Error: midjargon.engines.fal.fal.FalPrompt() got multiple values for keyword 
argument 'extra_params'
____________________________ test_cli_perm_command _____________________________

    def test_cli_perm_command():
        """Test permutation expansion using CLI."""
        cli = MidjargonCLI()
        prompt = "a {red, blue} bird on a {branch, rock}"
        with StringIO() as capture_stdout:
            sys.stdout = capture_stdout
            cli.perm(prompt, json_output=True)
            sys.stdout = sys.__stdout__
>           data = parse_json_output(capture_stdout)

tests/integration/test_workflow.py:332: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

output_stream = <_io.StringIO object at 0x11006c040>

    def parse_json_output(output_stream: StringIO) -> Any:
        """Parse JSON output from the CLI, removing ANSI escape sequences if any."""
        output_stream.seek(0)
        output = output_stream.getvalue()
        # Remove ANSI escape sequences
        output = ANSI_ESCAPE.sub("", output)
        output = output.strip()
        if not output:
            msg = "No JSON found in output"
>           raise ValueError(msg)
E           ValueError: No JSON found in output

tests/cli/test_main.py:40: ValueError
_________________________ test_prompt_with_parameters __________________________

    def test_prompt_with_parameters():
        """Test prompt parsing with various parameters."""
        prompt = "a portrait --ar 16:9 --stylize 200 --chaos 50 --v 6"
        result = parse_midjargon_prompt(prompt)
    
        assert result.text == "a portrait"
>       assert result.parameters.aspect == "16:9"
E       AssertionError: assert '1:1' == '16:9'
E         
E         - 16:9
E         + 1:1

tests/test_core.py:31: AssertionError
___________________________ test_invalid_parameters ____________________________

    def test_invalid_parameters():
        """Test handling of invalid parameters."""
>       with pytest.raises(ValueError):
E       Failed: DID NOT RAISE <class 'ValueError'>

tests/test_core.py:49: Failed
____________________________ test_weighted_prompts _____________________________

    def test_weighted_prompts():
        """Test handling of weighted prompts."""
        prompt = "first prompt::0.7 second prompt::0.3"
        results = expand_midjargon_input(prompt)
    
>       assert len(results) == 2
E       AssertionError: assert 1 == 2
E        +  where 1 = len([PromptVariant(prompt=MidjourneyPrompt(text='first prompt::0.7 second prompt::0.3', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0)])

tests/test_core.py:80: AssertionError
____________________________ test_combined_features ____________________________

    def test_combined_features():
        """Test combination of multiple features."""
        prompt = "a {red, blue} bird::0.6 a {green, yellow} tree::0.4"
        results = expand_midjargon_input(prompt)
    
        assert len(results) == 4
        # Check first group
        red_blue = [r for r in results if "bird" in r.prompt.text]
>       assert len(red_blue) == 2
E       AssertionError: assert 4 == 2
E        +  where 4 = len([PromptVariant(prompt=MidjourneyPrompt(text='a red bird::0.6 a green tree::0.4', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0), PromptVariant(prompt=MidjourneyPrompt(text='a red bird::0.6 a yellow tree::0.4', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0), PromptVariant(prompt=MidjourneyPrompt(text='a blue bird::0.6 a green tree::0.4', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0), PromptVariant(prompt=MidjourneyPrompt(text='a blue bird::0.6 a yellow tree::0.4', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]), weight=1.0)])

tests/test_core.py:93: AssertionError
___________________________ test_character_reference ___________________________

    def test_character_reference():
        """Test handling of character references."""
        prompt = "test --cref https://example.com/char.jpg --cw 50"
        result = parse_midjargon_prompt(prompt)
    
        assert result.character_reference
        assert str(result.character_reference[0].url) == "https://example.com/char.jpg"
>       assert result.character_weight == 50
E       AssertionError: assert 100 == 50
E        +  where 100 = MidjourneyPrompt(text='test', image_prompts=[], stylize=100, chaos=0, weird=0, image_weight=1.0, seed=None, stop=100, aspect_width=None, aspect_height=None, aspect_ratio=None, style=None, version=None, personalization=False, quality=1.0, character_reference=[CharacterReference(url=HttpUrl('https://example.com/char.jpg'), weight=1.0, code=None)], character_weight=100, style_reference=[], style_weight=None, style_version=2, repeat=None, turbo=False, relax=False, tile=False, negative_prompt=None, extra_params={}, images=[]).character_weight

tests/test_core.py:126: AssertionError
____________________________ test_prompt_to_string _____________________________

prompt = 'a portrait --stylize 200 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
>           return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:153: ValidationError

During handling of the above exception, another exception occurred:

    def test_prompt_to_string():
        """Test conversion of prompt back to string format."""
        original = "a portrait --ar 16:9 --stylize 200"
        result = parse_midjargon_prompt(original)
    
        # Convert back to string
        output = result.to_string()
    
        # Parse again to verify equivalence
>       reparsed = parse_midjargon_prompt(output)

tests/test_core.py:138: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

prompt = 'a portrait --stylize 200 --chaos 0 --weird 0 --aspect 1:1 --tile False --turbo False --relax False --no [] --character_reference [] --style_reference []'

    def parse_midjargon_prompt(prompt: str) -> MidjourneyPrompt:
        """Parse a Midjourney prompt into a validated MidjourneyPrompt object.
    
        Args:
            prompt: The raw prompt string to parse.
    
        Returns:
            A validated MidjourneyPrompt object.
    
        Raises:
            ValueError: If the prompt is invalid or missing required components.
        """
        # Extract image URLs
        images, remaining_text = extract_image_urls(prompt)
    
        # Split into text and parameters
        if " --" in remaining_text:
            text_part, param_part = remaining_text.split(" --", 1)
            text_part = text_part.strip()
            param_str = "--" + param_part.strip()
            try:
                parameters = parse_parameters(param_str)
            except Exception as e:
                msg = f"Failed to parse parameters: {e!s}"
                raise ValueError(msg)
        else:
            text_part = remaining_text.strip()
            parameters = {}
    
        # Create and validate the prompt object
        try:
            return MidjourneyPrompt(
                text=text_part,
                image_prompts=images,
                **parameters,
            )
        except Exception as e:
            msg = f"Failed to create prompt object: {e!s}"
>           raise ValueError(msg)
E           ValueError: Failed to create prompt object: 2 validation errors for MidjourneyPrompt
E           character_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type
E           style_reference
E             Input should be a valid list [type=list_type, input_value='[]', input_type=str]
E               For further information visit https://errors.pydantic.dev/2.10/v/list_type

src/midjargon/core/parser.py:160: ValueError
============================= slowest 10 durations =============================

(10 durations < 0.005s hidden.  Use -vv to show these durations.)
=========================== short test summary info ============================
FAILED tests/cli/test_main.py::test_basic_prompt - TypeError: MidjargonCLI.js...
FAILED tests/cli/test_main.py::test_permutations - ValueError: No JSON found ...
FAILED tests/cli/test_main.py::test_raw_output - TypeError: MidjargonCLI.json...
FAILED tests/cli/test_main.py::test_json_output_formatting - TypeError: Midja...
FAILED tests/cli/test_main.py::test_invalid_input - TypeError: MidjargonCLI.j...
FAILED tests/cli/test_main.py::test_parameter_validation - TypeError: Midjarg...
FAILED tests/cli/test_main.py::test_image_url_handling - TypeError: Midjargon...
FAILED tests/cli/test_main.py::test_no_color_output - TypeError: MidjargonCLI...
FAILED tests/cli/test_main.py::test_complex_prompt - TypeError: MidjargonCLI....
FAILED tests/cli/test_main.py::test_personalization_parameter - TypeError: Mi...
FAILED tests/cli/test_main.py::test_numeric_range_permutations - TypeError: M...
FAILED tests/cli/test_main.py::test_nested_parameter_permutations - TypeError...
FAILED tests/cli/test_main.py::test_mj_command - SystemExit: 1
FAILED tests/cli/test_main.py::test_fal_command - SystemExit: 1
FAILED tests/cli/test_main.py::test_perm_command - ValueError: No JSON found ...
FAILED tests/core/test_input.py::test_basic_input - AssertionError: assert Pr...
FAILED tests/core/test_input.py::test_single_permutation - AssertionError: as...
FAILED tests/core/test_input.py::test_empty_input - AssertionError: assert Pr...
FAILED tests/core/test_input.py::test_multiple_permutations - AssertionError:...
FAILED tests/core/test_input.py::test_nested_permutations - ValueError: Faile...
FAILED tests/core/test_input.py::test_escaped_braces - AssertionError: assert...
FAILED tests/core/test_input.py::test_escaped_commas - AssertionError: assert...
FAILED tests/core/test_input.py::test_unmatched_braces - ValueError: Unclosed...
FAILED tests/core/test_input.py::test_empty_permutation - ValueError: Empty p...
FAILED tests/core/test_input.py::test_whitespace_handling - AssertionError: a...
FAILED tests/core/test_input.py::test_expand_midjargon_input - AssertionError...
FAILED tests/core/test_input.py::test_handling_escaped_characters - Assertion...
FAILED tests/core/test_parameters.py::test_basic_parameter_parsing - Assertio...
FAILED tests/core/test_parameters.py::test_flag_parameters - assert True is None
FAILED tests/core/test_parameters.py::test_parameter_with_multiple_values - A...
FAILED tests/core/test_parameters.py::test_parameter_with_spaces - ValueError...
FAILED tests/core/test_parameters.py::test_mixed_parameters - ValueError: Fai...
FAILED tests/core/test_parameters.py::test_shorthand_parameters - AssertionEr...
FAILED tests/core/test_parameters.py::test_niji_version_parameter - Assertion...
FAILED tests/core/test_parameters.py::test_version_parameter - AssertionError...
FAILED tests/core/test_parameters.py::test_personalization_parameter - assert...
FAILED tests/core/test_parameters.py::test_reference_parameters - AssertionEr...
FAILED tests/core/test_parameters.py::test_invalid_parameters - Failed: DID N...
FAILED tests/core/test_parameters.py::test_parse_parameters - AssertionError:...
FAILED tests/core/test_parameters.py::test_flag_parameters_handling - assert ...
FAILED tests/core/test_parameters.py::test_special_seed_values - ValueError: ...
FAILED tests/core/test_parameters.py::test_reference_url_handling - Assertion...
FAILED tests/core/test_parameters.py::test_niji_version_handling - AssertionE...
FAILED tests/core/test_parser.py::test_basic_prompt_parsing - KeyError: 'aspect'
FAILED tests/core/test_parser.py::test_prompt_with_image_url - AssertionError...
FAILED tests/core/test_parser.py::test_prompt_with_multiple_image_urls - Asse...
FAILED tests/core/test_parser.py::test_prompt_with_parameters - KeyError: 'as...
FAILED tests/core/test_parser.py::test_prompt_with_empty_parameters - assert ...
FAILED tests/engines/midjourney/test_midjourney_parser.py::test_aspect_ratio
FAILED tests/engines/midjourney/test_midjourney_parser.py::test_invalid_values
FAILED tests/engines/midjourney/test_midjourney_parser.py::test_empty_values
FAILED tests/integration/test_workflow.py::test_basic_workflow - ValueError: ...
FAILED tests/integration/test_workflow.py::test_permutation_workflow - ValueE...
FAILED tests/integration/test_workflow.py::test_image_workflow - ValueError: ...
FAILED tests/integration/test_workflow.py::test_parameter_workflow - ValueErr...
FAILED tests/integration/test_workflow.py::test_new_parameters_workflow - Val...
FAILED tests/integration/test_workflow.py::test_weighted_prompts_workflow - V...
FAILED tests/integration/test_workflow.py::test_error_workflow - AssertionErr...
FAILED tests/integration/test_workflow.py::test_complex_workflow - ValueError...
FAILED tests/integration/test_workflow.py::test_permutations_with_parameters
FAILED tests/integration/test_workflow.py::test_permutations_with_flag_parameters
FAILED tests/integration/test_workflow.py::test_permutations_with_complex_parameters
FAILED tests/integration/test_workflow.py::test_cli_mj_command - SystemExit: 1
FAILED tests/integration/test_workflow.py::test_cli_fal_command - SystemExit: 1
FAILED tests/integration/test_workflow.py::test_cli_perm_command - ValueError...
FAILED tests/test_core.py::test_prompt_with_parameters - AssertionError: asse...
FAILED tests/test_core.py::test_invalid_parameters - Failed: DID NOT RAISE <c...
FAILED tests/test_core.py::test_weighted_prompts - AssertionError: assert 1 == 2
FAILED tests/test_core.py::test_combined_features - AssertionError: assert 4 ...
FAILED tests/test_core.py::test_character_reference - AssertionError: assert ...
FAILED tests/test_core.py::test_prompt_to_string - ValueError: Failed to crea...
======================== 71 failed, 21 passed in 1.07s =========================
