Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 03c71f5

Browse files
committed
added test for code path where the object passed into frames is
does not have a length.
1 parent b57c6dc commit 03c71f5

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

lib/matplotlib/tests/test_animation.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,25 @@ def animate(i):
5252
anim.save(F.name, fps=30, writer=writer)
5353

5454

55+
@cleanup
56+
def test_():
57+
fig, ax = plt.subplots()
58+
line, = ax.plot([], [])
59+
60+
def init():
61+
line.set_data([], [])
62+
return line,
63+
64+
def animate(i):
65+
x = np.linspace(0, 10, 100)
66+
y = np.sin(x + i)
67+
line.set_data(x, y)
68+
return line,
69+
70+
anim = animation.FuncAnimation(fig, animate, init_func=init,
71+
frames=iter(range(5)))
72+
73+
5574
if __name__ == "__main__":
5675
import nose
5776
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)