A community-maintained Python framework for creating mathematical animations.
Add test for the dash-as-filename feature. (#4)
Aathish7cd6216c5fce
diff --git a/tests/test_cli/dash_test_script.txt b/tests/test_cli/dash_test_script.txtnew file mode 100644index 000000000..e896e1327--- /dev/null+++ b/tests/test_cli/dash_test_script.txt@@ -0,0 +1,5 @@+# from manim import *+class Dash_Test(Scene):+ def construct(self):+ self.play(ReplacementTransform(Square(),Circle()))+ self.wait(2)\ No newline at end of filediff --git a/tests/test_cli/test_cli.py b/tests/test_cli/test_cli.pyindex ebe4462b8..eb1e2c2c0 100644--- a/tests/test_cli/test_cli.py+++ b/tests/test_cli/test_cli.py@@ -4,10 +4,11 @@ from shutil import rmtreeimport pytest-def capture(command):+def capture(command,instream=None):proc = subprocess.Popen(command,stdout=subprocess.PIPE,stderr=subprocess.PIPE,+ stdin=instream)out, err = proc.communicate()return out, err, proc.returncode@@ -44,3 +45,17 @@ def test_WriteStuff(python_version):assert os.path.exists(os.path.join(path_output, "videos", "basic_scenes", "480p15", "WriteStuff.mp4")), errrmtree(path_output)+[email protected]_end_to_end+def test_dash_as_name(python_version):+ """Simulate using - as a filename. Intended to test the feature that allows end users to type manim code on the spot."""+ path_output = os.path.join("tests_cache", "media_temp")+ command = [python_version, "-m", "manim", "-", "-l", "--media_dir", path_output]+ out, err, exitcode = capture(+ command,+ open(os.path.join(os.path.dirname(__file__), "dash_test_script.txt"))+ )+ assert exitcode == 0, err+ assert os.path.exists(os.path.join(+ path_output, "videos", "-", "480p15", "Dash_Test.mp4")), err+ rmtree(path_output)