mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-29 10:02:11 +00:00
* add a context manager to temporarily change the global config. This will be useful for testing * make Camera instances read some of their values from the global config dict at construction, and not when the Camera class is defined as it was previously done * update test_logging to use the correct expected.txt file
16 lines
563 B
Python
16 lines
563 B
Python
import pytest
|
|
from manim import Camera, tempconfig, config
|
|
|
|
|
|
def test_camera():
|
|
"""Test that Camera instances initialize to the correct config."""
|
|
# by default, use the config
|
|
assert Camera().frame_width == config["frame_width"]
|
|
# init args override config
|
|
assert Camera(frame_width=10).frame_width == 10
|
|
|
|
# if config changes, reflect those changes
|
|
with tempconfig({"frame_width": 100}):
|
|
assert Camera().frame_width == 100
|
|
# ..init args still override new config
|
|
assert Camera(frame_width=10).frame_width == 10
|