Lint test_prompters
Browse files- tests/test_prompters.py +8 -2
tests/test_prompters.py
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
|
|
|
|
|
| 1 |
import unittest
|
| 2 |
|
| 3 |
from axolotl.prompters import AlpacaPrompter, PromptStyle
|
| 4 |
|
| 5 |
|
| 6 |
class AlpacaPrompterTest(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
def test_prompt_style_w_none(self):
|
| 8 |
prompter = AlpacaPrompter(prompt_style=None)
|
| 9 |
res = next(prompter.build_prompt("tell me a joke"))
|
|
@@ -11,7 +17,7 @@ class AlpacaPrompterTest(unittest.TestCase):
|
|
| 11 |
assert "### Instruction:" in res
|
| 12 |
|
| 13 |
def test_prompt_style_w_instruct(self):
|
| 14 |
-
prompter = AlpacaPrompter(prompt_style=PromptStyle.
|
| 15 |
res = next(
|
| 16 |
prompter.build_prompt("tell me a joke about the following", "alpacas")
|
| 17 |
)
|
|
@@ -31,7 +37,7 @@ class AlpacaPrompterTest(unittest.TestCase):
|
|
| 31 |
assert "ASSISTANT:" not in res
|
| 32 |
|
| 33 |
def test_prompt_style_w_chat(self):
|
| 34 |
-
prompter = AlpacaPrompter(prompt_style=PromptStyle.
|
| 35 |
res = next(
|
| 36 |
prompter.build_prompt("tell me a joke about the following", "alpacas")
|
| 37 |
)
|
|
|
|
| 1 |
+
"""Module testing prompters"""
|
| 2 |
+
|
| 3 |
import unittest
|
| 4 |
|
| 5 |
from axolotl.prompters import AlpacaPrompter, PromptStyle
|
| 6 |
|
| 7 |
|
| 8 |
class AlpacaPrompterTest(unittest.TestCase):
|
| 9 |
+
"""
|
| 10 |
+
Test AlpacaPrompter
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
def test_prompt_style_w_none(self):
|
| 14 |
prompter = AlpacaPrompter(prompt_style=None)
|
| 15 |
res = next(prompter.build_prompt("tell me a joke"))
|
|
|
|
| 17 |
assert "### Instruction:" in res
|
| 18 |
|
| 19 |
def test_prompt_style_w_instruct(self):
|
| 20 |
+
prompter = AlpacaPrompter(prompt_style=PromptStyle.INSTRUCT.value)
|
| 21 |
res = next(
|
| 22 |
prompter.build_prompt("tell me a joke about the following", "alpacas")
|
| 23 |
)
|
|
|
|
| 37 |
assert "ASSISTANT:" not in res
|
| 38 |
|
| 39 |
def test_prompt_style_w_chat(self):
|
| 40 |
+
prompter = AlpacaPrompter(prompt_style=PromptStyle.CHAT.value)
|
| 41 |
res = next(
|
| 42 |
prompter.build_prompt("tell me a joke about the following", "alpacas")
|
| 43 |
)
|