File size: 1,250 Bytes
83a8f68 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
def mock_text_generation(input_text):
# 樑ζζζ¬ηζι»θΎ
if input_text == "Tell me a joke.":
return "Why don't scientists trust atoms? Because they make up everything!"
return "I can come up with many ideas, but that request has stumped me!"
def mock_code_generation(input_code):
# 樑ζ代η ηζι»θΎ
if input_code == "def greet(name):":
return "def greet(name):\n return f'Hello, {name}!'"
return "Hmm, I'm not sure how to complete that one."
# ζ΅θ―ζζ¬ηζεθ½
input_text = "Tell me a joke."
expected_output_text = "Why don't scientists trust atoms? Because they make up everything!"
generated_text = mock_text_generation(input_text)
assert generated_text == expected_output_text, f"Text generation test failed: expected {expected_output_text}, got {generated_text}"
print("Text generation test passed")
# ζ΅θ―代η ηζεθ½
input_code = "def greet(name):"
expected_output_code = "def greet(name):\n return f'Hello, {name}!'"
generated_code = mock_code_generation(input_code)
assert generated_code == expected_output_code, f"Code generation test failed: expected {expected_output_code}, got {generated_code}"
print("Code generation test passed")
|