Skip to content

Commit fe42398

Browse files
committed
Move large example prompt responses in lliam tests to constants.
1 parent 76da14a commit fe42398

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

aws_doc_sdk_examples_tools/lliam/test/run_ailly_test.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,7 @@
88
VALUE_PREFIXES,
99
)
1010

11-
12-
@pytest.fixture
13-
def test_environment():
14-
with tempfile.TemporaryDirectory() as temp_dir:
15-
temp_path = Path(temp_dir)
16-
ailly_dir = temp_path / "ailly_dir"
17-
ailly_dir.mkdir(exist_ok=True)
18-
19-
output_path = temp_path / "iam_updates.json"
20-
21-
create_sample_ailly_files(ailly_dir)
22-
23-
yield {
24-
"ailly_dir": ailly_dir,
25-
"output_path": output_path,
26-
"temp_dir": temp_path,
27-
}
28-
29-
30-
def create_sample_ailly_files(ailly_dir):
31-
# Sample file 1
32-
file1_path = ailly_dir / "iam-policies.SomeGuide.1.md.ailly.md"
33-
with open(file1_path, "w") as f:
34-
f.write(
35-
"""# IAM Policy Example for S3 Bucket Access
11+
SAMPLE_PROMPT_RESPONSE_1 = """# IAM Policy Example for S3 Bucket Access
3612
3713
This example demonstrates how to create an IAM policy that grants read-only access to an S3 bucket.
3814
@@ -75,13 +51,8 @@ def create_sample_ailly_files(ailly_dir):
7551
7652
Remember to replace 'example-bucket' with your actual bucket name when using this policy.
7753
"""
78-
)
7954

80-
# Sample file 2
81-
file2_path = ailly_dir / "iam-policies.SomeGuide.2.md.ailly.md"
82-
with open(file2_path, "w") as f:
83-
f.write(
84-
"""# IAM Policy Example for EC2 Instance Management
55+
SAMPLE_PROMPT_RESPONSE_2 = """# IAM Policy Example for EC2 Instance Management
8556
8657
This example demonstrates how to create an IAM policy for EC2 instance management.
8758
@@ -128,7 +99,36 @@ def create_sample_ailly_files(ailly_dir):
12899
129100
Modify the region condition to match your specific requirements.
130101
"""
131-
)
102+
103+
104+
@pytest.fixture
105+
def test_environment():
106+
with tempfile.TemporaryDirectory() as temp_dir:
107+
temp_path = Path(temp_dir)
108+
ailly_dir = temp_path / "ailly_dir"
109+
ailly_dir.mkdir(exist_ok=True)
110+
111+
output_path = temp_path / "iam_updates.json"
112+
113+
create_sample_ailly_files(ailly_dir)
114+
115+
yield {
116+
"ailly_dir": ailly_dir,
117+
"output_path": output_path,
118+
"temp_dir": temp_path,
119+
}
120+
121+
122+
def create_sample_ailly_files(ailly_dir):
123+
# Sample file 1
124+
file1_path = ailly_dir / "iam-policies.SomeGuide.1.md.ailly.md"
125+
with open(file1_path, "w") as f:
126+
f.write(SAMPLE_PROMPT_RESPONSE_1)
127+
128+
# Sample file 2
129+
file2_path = ailly_dir / "iam-policies.SomeGuide.2.md.ailly.md"
130+
with open(file2_path, "w") as f:
131+
f.write(SAMPLE_PROMPT_RESPONSE_2)
132132

133133

134134
def test_process_ailly_files(test_environment):

0 commit comments

Comments
 (0)