manim/tests/test_camera.py
Leo Torres c89a441d8b
Refactor config (#340)
* 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
2020-08-28 15:44:46 -04:00

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