manim/tests/test_get_set.py
Naveen M K dcb90a8656
Format Imports using Isort (#1178)
* Format imports using Isort.
Add a check for pull requests.

Signed-off-by: Naveen M K <naveen@syrusdark.website>

* CI: update check's name
2021-04-03 13:45:12 +05:30

41 lines
763 B
Python

import types
import pytest
from manim.mobject.mobject import Mobject
def test_generic_set():
m = Mobject()
m.set(test=0)
assert m.test == 0
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_get_compat_layer():
m = Mobject()
assert isinstance(m.get_test, types.MethodType)
with pytest.raises(AttributeError):
m.get_test()
m.test = 0
assert m.get_test() == 0
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_set_compat_layer():
m = Mobject()
assert isinstance(m.set_test, types.MethodType)
m.set_test(0)
assert m.test == 0
def test_nonexistent_attr():
m = Mobject()
with pytest.raises(AttributeError, match="object has no attribute"):
m.test