Skip to content

Commit

Permalink
Added a few more tests using mobject generation
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-warfield committed May 17, 2020
1 parent ebd4f73 commit 853b608
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/test_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,15 @@ def test_scale(self):
np.testing.assert_array_equal(obj.points,
np.array([[x * s, y * s, z * s]]))

def test_scale_property(self):
gen = mob_gen.MobjectGenerator(max_depth=0)
obj = gen.next()
og = copy.deepcopy(obj)
obj.scale(10)
np.testing.assert_array_less(
np.absolute(og.get_all_points()),
np.absolute(obj.get_all_points()))

def test_rotate_returns_self(self):
a = random.Random().randint(-1000, 1000)
x = random.Random().randint(-1000, 1000)
Expand Down Expand Up @@ -440,6 +449,20 @@ def test_center(self):
obj.center()
np.testing.assert_array_equal(obj.points, np.zeros((1, 3)))

def test_center_negative_bound_object(self):
gen = mob_gen.MobjectGenerator(upper_bound=-1)
obj = gen.next()
og = copy.deepcopy(obj)
obj.center()
np.testing.assert_array_less(og.get_all_points(), obj.get_all_points())

def test_center_positive_bound_object(self):
gen = mob_gen.MobjectGenerator(lower_bound=1)
obj = gen.next()
og = copy.deepcopy(obj)
obj.center()
np.testing.assert_array_less(obj.get_all_points(), og.get_all_points())

def test_align_on_border_returns_self(self):
obj = Mobject()
obj.points = np.zeros((1, 3))
Expand Down

0 comments on commit 853b608

Please sign in to comment.