def test_vmob_add_to_back(): """Test the Mobject add_to_back method.""" a = VMobject() b = Line() c = "text" with pytest.raises(ValueError): # Mobject cannot contain self a.add_to_back(a) with pytest.raises(TypeError): # All submobjects must be of type Mobject a.add_to_back(c) # No submobject gets added twice a.add_to_back(b) a.add_to_back(b, b) assert len(a.submobjects) == 1
def test_vmob_add_to_back(): """Test the Mobject add_to_back method.""" a = VMobject() b = Line() c = "text" with pytest.raises(ValueError): # Mobject cannot contain self a.add_to_back(a) with pytest.raises(TypeError): # All submobjects must be of type Mobject a.add_to_back(c) # No submobject gets added twice a.add_to_back(b) a.add_to_back(b, b) assert len(a.submobjects) == 1 a.submobjects.clear() a.add_to_back(b, b, b) a.add_to_back(b, b) assert len(a.submobjects) == 1 a.submobjects.clear() # Make sure the ordering has not changed o1, o2, o3 = Square(), Line(), Circle() a.add_to_back(o1, o2, o3) assert a.submobjects.pop() == o3 assert a.submobjects.pop() == o2 assert a.submobjects.pop() == o1