Include utility modules, shared channels, prompts, read-only skills, wardrobe memory and regression tests. Externalize legacy credentials and exclude private runtime state.
27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
"""Avoid formulaic user-intent paraphrase openings without removing address preferences."""
|
|
from pathlib import Path
|
|
import sys
|
|
import unittest
|
|
BASE = Path(__file__).resolve().parents[1]
|
|
sys.path[:0] = [str(BASE / 'bot-utility'), str(BASE)]
|
|
from chat import engine
|
|
|
|
|
|
class NoParaphraseOpenerTests(unittest.TestCase):
|
|
def test_global_style_covers_template_and_same_family(self):
|
|
text = engine.load_instruction('style_instructions.txt')
|
|
for phrase in ('主人这是在……呀', '原来主人是在', '看来主人是想',
|
|
'主人这是……呢', '你这是/看来你是/所以你是',
|
|
'无需每次先概括、解释或揣测', '不把猜测说成事实',
|
|
'“主人”这个称呼保留并自然使用'):
|
|
self.assertIn(phrase, text)
|
|
|
|
def test_live_and_builtin_defaults_match(self):
|
|
text = engine.load_instruction('style_instructions.txt')
|
|
self.assertEqual(text.strip(), engine.DEFAULT_STYLE_INSTRUCTIONS.strip())
|
|
self.assertIn('主人这是在……呀', engine.BASE_PROMPT)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|