fmt: re-linted files
This commit is contained in:
50
test_main.py
50
test_main.py
@ -3,7 +3,6 @@ from unittest import TestCase
|
||||
from main import SimpleMarkupParser
|
||||
|
||||
|
||||
|
||||
class Test(TestCase):
|
||||
def test_simple_markup_parser_0(self):
|
||||
# Test case with sections
|
||||
@ -13,27 +12,34 @@ class Test(TestCase):
|
||||
parsed_output = parser.get_output()
|
||||
|
||||
assert len(parsed_output) == 7, "Expected 7 tokens, got %d" % len(parsed_output)
|
||||
assert parsed_output[0] == {'type': 'section_start', 'section_id': 1}
|
||||
assert parsed_output[1] == {'type': 'voice', 'voice': 'alloy'}
|
||||
assert parsed_output[2] == {'type': 'text', 'text': 'Hello, this is section 1.'}
|
||||
assert parsed_output[3] == {'type': 'section_end'}
|
||||
assert parsed_output[4] == {'type': 'voice', 'voice': 'nova'}
|
||||
assert parsed_output[5] == {'type': 'text', 'text': "Now we're outside the section."}
|
||||
assert parsed_output[6] == {'type': 'insert_section', 'section_id': 1}
|
||||
|
||||
assert parsed_output[0] == {"type": "section_start", "section_id": 1}
|
||||
assert parsed_output[1] == {"type": "voice", "voice": "alloy"}
|
||||
assert parsed_output[2] == {"type": "text", "text": "Hello, this is section 1."}
|
||||
assert parsed_output[3] == {"type": "section_end"}
|
||||
assert parsed_output[4] == {"type": "voice", "voice": "nova"}
|
||||
assert parsed_output[5] == {
|
||||
"type": "text",
|
||||
"text": "Now we're outside the section.",
|
||||
}
|
||||
assert parsed_output[6] == {"type": "insert_section", "section_id": 1}
|
||||
|
||||
def test_simple_markup_parser_1(self):
|
||||
# Test case with silence
|
||||
markup_text = "[voice nova] Let's have a moment of silence. [silence 3s] And we're back!"
|
||||
markup_text = (
|
||||
"[voice nova] Let's have a moment of silence. [silence 3s] And we're back!"
|
||||
)
|
||||
parser = SimpleMarkupParser(markup_text)
|
||||
parser.parse()
|
||||
parsed_output = parser.get_output()
|
||||
|
||||
assert len(parsed_output) == 4
|
||||
assert parsed_output[0] == {'type': 'voice', 'voice': 'nova'}
|
||||
assert parsed_output[1] == {'type': 'text', 'text': "Let's have a moment of silence."}
|
||||
assert parsed_output[2] == {'type': 'silence', 'duration': 3000}
|
||||
assert parsed_output[3] == {'type': 'text', 'text': "And we're back!"}
|
||||
assert parsed_output[0] == {"type": "voice", "voice": "nova"}
|
||||
assert parsed_output[1] == {
|
||||
"type": "text",
|
||||
"text": "Let's have a moment of silence.",
|
||||
}
|
||||
assert parsed_output[2] == {"type": "silence", "duration": 3000}
|
||||
assert parsed_output[3] == {"type": "text", "text": "And we're back!"}
|
||||
|
||||
def test_simple_markup_parser_2(self):
|
||||
# Test case with unknown markup
|
||||
@ -43,10 +49,12 @@ class Test(TestCase):
|
||||
parsed_output = parser.get_output()
|
||||
|
||||
assert len(parsed_output) == 6
|
||||
assert parsed_output[0] == {'type': 'voice', 'voice': 'fable'}
|
||||
assert parsed_output[1] == {'type': 'text', 'text': 'Hello!'}
|
||||
assert parsed_output[2] == {'type': 'none', 'text': '[unknown_markup]'}
|
||||
assert parsed_output[3] == {'type': 'text', 'text': 'This is an unknown markup.'}
|
||||
assert parsed_output[4] == {'type': 'voice', 'voice': 'nova'}
|
||||
assert parsed_output[5] == {'type': 'text', 'text': 'Back to a known voice.'}
|
||||
|
||||
assert parsed_output[0] == {"type": "voice", "voice": "fable"}
|
||||
assert parsed_output[1] == {"type": "text", "text": "Hello!"}
|
||||
assert parsed_output[2] == {"type": "none", "text": "[unknown_markup]"}
|
||||
assert parsed_output[3] == {
|
||||
"type": "text",
|
||||
"text": "This is an unknown markup.",
|
||||
}
|
||||
assert parsed_output[4] == {"type": "voice", "voice": "nova"}
|
||||
assert parsed_output[5] == {"type": "text", "text": "Back to a known voice."}
|
||||
|
Reference in New Issue
Block a user