Skip to content

Commit 6ab6f6e

Browse files
committed
add tests for deprecated field
1 parent 84e3bc6 commit 6ab6f6e

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/test_rails_config.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,3 +1015,43 @@ def test_hero_topic_safety_prompt_raises(self):
10151015
content: Verify the user input is on-topic
10161016
"""
10171017
)
1018+
1019+
1020+
class TestDeprecatedStreamingConfig:
1021+
"""Tests for deprecated streaming config field."""
1022+
1023+
def test_streaming_config_field_accepted(self):
1024+
"""Test that the deprecated streaming: True config field is still accepted."""
1025+
config = RailsConfig.from_content(
1026+
yaml_content="""
1027+
models: []
1028+
streaming: True
1029+
"""
1030+
)
1031+
assert config.streaming is True
1032+
1033+
def test_streaming_config_field_default_false(self):
1034+
"""Test that streaming defaults to False when not specified."""
1035+
config = RailsConfig.from_content(
1036+
yaml_content="""
1037+
models: []
1038+
"""
1039+
)
1040+
assert config.streaming is False
1041+
1042+
def test_streaming_config_field_shows_deprecation_warning(self):
1043+
"""Test that using streaming: True shows a deprecation warning."""
1044+
import warnings
1045+
1046+
with warnings.catch_warnings(record=True) as w:
1047+
warnings.simplefilter("always")
1048+
config = RailsConfig.from_content(
1049+
yaml_content="""
1050+
models: []
1051+
streaming: True
1052+
"""
1053+
)
1054+
assert config.streaming is True
1055+
1056+
deprecation_warnings = [warning for warning in w if "streaming" in str(warning.message).lower()]
1057+
assert len(deprecation_warnings) > 0, "Expected a deprecation warning for 'streaming' field"

0 commit comments

Comments
 (0)