mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
* start test reorganization * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * move boolean ops * move more tests * Move more tests * more reorganization * more movements * mostly finish up reorganization * Finish reorganization tests in parent dir * try moving interface tests back * Move test_commands over * fix relative path to templates Co-authored-by: Darylgolden <darylgolden@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from manim import MarkupText
|
|
|
|
|
|
def test_good_markup():
|
|
"""Test creation of valid :class:`MarkupText` object"""
|
|
try:
|
|
text1 = MarkupText("<b>foo</b>")
|
|
text2 = MarkupText("foo")
|
|
success = True
|
|
except ValueError:
|
|
success = False
|
|
assert success, "'<b>foo</b>' and 'foo' should not fail validation"
|
|
|
|
|
|
def test_special_tags_markup():
|
|
"""Test creation of valid :class:`MarkupText` object with unofficial tags"""
|
|
try:
|
|
text1 = MarkupText('<color col="RED">foo</color>')
|
|
text1 = MarkupText('<gradient from="RED" to="YELLOW">foo</gradient>')
|
|
success = True
|
|
except ValueError:
|
|
success = False
|
|
assert (
|
|
success
|
|
), '\'<color col="RED">foo</color>\' and \'<gradient from="RED" to="YELLOW">foo</gradient>\' should not fail validation'
|
|
|
|
|
|
def test_unbalanced_tag_markup():
|
|
"""Test creation of invalid :class:`MarkupText` object (unbalanced tag)"""
|
|
try:
|
|
text = MarkupText("<b>foo")
|
|
success = False
|
|
except ValueError:
|
|
success = True
|
|
assert success, "'<b>foo' should fail validation"
|
|
|
|
|
|
def test_invalid_tag_markup():
|
|
"""Test creation of invalid :class:`MarkupText` object (invalid tag)"""
|
|
try:
|
|
text = MarkupText("<invalidtag>foo</invalidtag>")
|
|
success = False
|
|
except ValueError:
|
|
success = True
|
|
|
|
assert success, "'<invalidtag>foo</invalidtag>' should fail validation"
|