def test_single_arg(self): fig = plt.figure() ax1 = fig.add_subplot('311') ax1.plot([1], [2]) ax2 = fig.add_subplot('312') ax2.plot([3], [4]) ax3 = fig.add_subplot('313') ax3.plot([5], [6]) iterable_method_call(fig.axes, 'set_xlabel', False, 'xx') assert_equal(fig.axes[0].get_xlabel(), "xx") assert_equal(fig.axes[1].get_xlabel(), "xx") assert_equal(fig.axes[2].get_xlabel(), "xx")
def test_one_to_one(self): fig = plt.figure() ax1 = fig.add_subplot('311') ax1.plot([1], [2]) ax2 = fig.add_subplot('312') ax2.plot([3], [4]) ax3 = fig.add_subplot('313') ax3.plot([5], [6]) iterable_method_call(fig.axes, 'set_xlabel', False, *['x1', None, 'x3']) assert_equal(fig.axes[0].get_xlabel(), "x1") assert_equal(fig.axes[1].get_xlabel(), "") assert_equal(fig.axes[2].get_xlabel(), "x3")
def test_unpack(self): fig = plt.figure() ax1 = fig.add_subplot('311') ax1.plot([1], [2]) ax2 = fig.add_subplot('312') ax2.plot([3], [4]) ax3 = fig.add_subplot('313') ax3.plot([5], [6]) #this is a bad test because with xlim expect the same answer from unpack =True or unpack=False iterable_method_call(fig.axes, 'set_xlim', True, (5, 8), None, (1, 6)) assert_equal(fig.axes[0].get_xlim(), (5, 8)) # assert_equal(fig.axes[1].get_xlim(),None) assert_equal(fig.axes[2].get_xlim(), (1, 6))
def test_single_arg(self): fig = plt.figure() ax1=fig.add_subplot('311') ax1.plot([1],[2]) ax2=fig.add_subplot('312') ax2.plot([3],[4]) ax3=fig.add_subplot('313') ax3.plot([5],[6]) iterable_method_call(fig.axes, 'set_xlabel', False, 'xx') assert_equal(fig.axes[0].get_xlabel(),"xx") assert_equal(fig.axes[1].get_xlabel(),"xx") assert_equal(fig.axes[2].get_xlabel(),"xx")
def test_one_to_one(self): fig = plt.figure() ax1=fig.add_subplot('311') ax1.plot([1],[2]) ax2=fig.add_subplot('312') ax2.plot([3],[4]) ax3=fig.add_subplot('313') ax3.plot([5],[6]) iterable_method_call(fig.axes, 'set_xlabel', False, *['x1', None, 'x3']) assert_equal(fig.axes[0].get_xlabel(),"x1") assert_equal(fig.axes[1].get_xlabel(),"") assert_equal(fig.axes[2].get_xlabel(),"x3")
def test_unpack(self): fig = plt.figure() ax1=fig.add_subplot('311') ax1.plot([1],[2]) ax2=fig.add_subplot('312') ax2.plot([3],[4]) ax3=fig.add_subplot('313') ax3.plot([5],[6]) #this is a bad test because with xlim expect the same answer from unpack =True or unpack=False iterable_method_call(fig.axes, 'set_xlim', True, (5,8), None, (1, 6)) assert_equal(fig.axes[0].get_xlim(),(5,8)) # assert_equal(fig.axes[1].get_xlim(),None) assert_equal(fig.axes[2].get_xlim(),(1,6))