Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement format_speak_tags from neon_utils #36

Merged
merged 3 commits into from
Mar 3, 2022
Merged

Conversation

NeonDaniel
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Mar 2, 2022

Codecov Report

❗ No coverage uploaded for pull request base (dev@71464ef). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##             dev     #36   +/-   ##
=====================================
  Coverage       ?   0.00%           
=====================================
  Files          ?      26           
  Lines          ?    1698           
  Branches       ?       0           
=====================================
  Hits           ?       0           
  Misses         ?    1698           
  Partials       ?       0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 71464ef...14f7c1e. Read the comment docs.

@JarbasAl
Copy link
Member

JarbasAl commented Mar 2, 2022

    def test_format_speak_tags_with_speech(self):
        valid_output = "<speak>Speak This.</speak>"
        no_tags = format_speak_tags("Speak This.")
        self.assertEqual(no_tags, valid_output)

        leading_only = format_speak_tags("<speak>Speak This.")
        self.assertEqual(leading_only, valid_output)

        leading_with_exclusion = format_speak_tags("Nope.<speak>Speak This.")
        self.assertEqual(leading_with_exclusion, valid_output)

        trailing_only = format_speak_tags("Speak This.</speak>")
        self.assertEqual(trailing_only, valid_output)

        trailing_with_exclusion = format_speak_tags("Speak This.</speak> But not this.")
        self.assertEqual(trailing_with_exclusion, valid_output)

        tagged = format_speak_tags("<speak>Speak This.</speak>")
        self.assertEqual(tagged, valid_output)

        tagged_with_exclusion = format_speak_tags("Don't<speak>Speak This.</speak>But Not this.")
        self.assertEqual(tagged_with_exclusion, valid_output)

    def test_format_speak_tags_empty(self):
        leading_closure = format_speak_tags("</speak>hello.")
        self.assertFalse(leading_closure)

        trailing_open = format_speak_tags("hello.<speak>")
        self.assertFalse(trailing_open)

    def test_format_speak_tags_with_speech_no_tags(self):
        valid_output = "Speak This."
        no_tags = format_speak_tags("Speak This.", False)
        self.assertEqual(no_tags, valid_output)

        leading_only = format_speak_tags("<speak>Speak This.", False)
        self.assertEqual(leading_only, valid_output)

        leading_with_exclusion = format_speak_tags("Nope.<speak>Speak This.", False)
        self.assertEqual(leading_with_exclusion, valid_output)

        trailing_only = format_speak_tags("Speak This.</speak>", False)
        self.assertEqual(trailing_only, valid_output)

        trailing_with_exclusion = format_speak_tags("Speak This.</speak> But not this.", False)
        self.assertEqual(trailing_with_exclusion, valid_output)

        tagged = format_speak_tags("<speak>Speak This.</speak>", False)
        self.assertEqual(tagged, valid_output)

        tagged_with_exclusion = format_speak_tags("Don't<speak>Speak This.</speak>But Not this.", False)
        self.assertEqual(tagged_with_exclusion, valid_output)

@JarbasAl JarbasAl added the enhancement New feature or request label Mar 2, 2022
@JarbasAl JarbasAl marked this pull request as ready for review March 3, 2022 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants