forked from 3b1b/manim
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: Remove redundancy in FunctionGraph arguments (3b1b#1018)
* Fix x_min, x_max and color of FunctionGraph * Add graphical unit test to FunctionGraph * Apply review suggestions * Pass color as argument instead of updating kwargs and run black
- Loading branch information
1 parent
3ad385a
commit dd74b00
Showing
3 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+6.29 KB
tests/control_data/graphical_units_data/functions/FunctionGraphTest.npz
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pytest | ||
import numpy as np | ||
|
||
from manim import * | ||
from ..utils.testing_utils import get_scenes_to_test | ||
from ..utils.GraphicalUnitTester import GraphicalUnitTester | ||
|
||
|
||
class FunctionGraphTest(Scene): | ||
def construct(self): | ||
graph = FunctionGraph( | ||
lambda x: 2 * np.cos(0.5 * x), x_min=-PI, x_max=PI, color=BLUE | ||
) | ||
self.add(graph) | ||
self.wait() | ||
|
||
|
||
MODULE_NAME = "functions" | ||
|
||
|
||
@pytest.mark.parametrize("scene_to_test", get_scenes_to_test(__name__), indirect=False) | ||
def test_scene(scene_to_test, tmpdir, show_diff): | ||
GraphicalUnitTester(scene_to_test[1], MODULE_NAME, tmpdir).test(show_diff=show_diff) |