Best Python code snippet using slash
test_pyplot.py
Source:test_pyplot.py  
...67    with pytest.raises(TypeError):68        plt.subplot(ncols=1)69def test_ioff():70    plt.ion()71    assert mpl.is_interactive()72    with plt.ioff():73        assert not mpl.is_interactive()74    assert mpl.is_interactive()75    plt.ioff()76    assert not mpl.is_interactive()77    with plt.ioff():78        assert not mpl.is_interactive()79    assert not mpl.is_interactive()80def test_ion():81    plt.ioff()82    assert not mpl.is_interactive()83    with plt.ion():84        assert mpl.is_interactive()85    assert not mpl.is_interactive()86    plt.ion()87    assert mpl.is_interactive()88    with plt.ion():89        assert mpl.is_interactive()90    assert mpl.is_interactive()91def test_nested_ion_ioff():92    # initial state is interactive93    plt.ion()94    # mixed ioff/ion95    with plt.ioff():96        assert not mpl.is_interactive()97        with plt.ion():98            assert mpl.is_interactive()99        assert not mpl.is_interactive()100    assert mpl.is_interactive()101    # redundant contexts102    with plt.ioff():103        with plt.ioff():104            assert not mpl.is_interactive()105    assert mpl.is_interactive()106    with plt.ion():107        plt.ioff()108    assert mpl.is_interactive()109    # initial state is not interactive110    plt.ioff()111    # mixed ioff/ion112    with plt.ion():113        assert mpl.is_interactive()114        with plt.ioff():115            assert not mpl.is_interactive()116        assert mpl.is_interactive()117    assert not mpl.is_interactive()118    # redundant contexts119    with plt.ion():120        with plt.ion():121            assert mpl.is_interactive()122    assert not mpl.is_interactive()123    with plt.ioff():124        plt.ion()125    assert not mpl.is_interactive()126def test_close():127    try:128        plt.close(1.1)129    except TypeError as e:130        assert str(e) == "close() argument must be a Figure, an int, " \131                         "a string, or None, not <class 'float'>"132def test_subplot_reuse():133    ax1 = plt.subplot(121)134    assert ax1 is plt.gca()135    ax2 = plt.subplot(122)136    assert ax2 is plt.gca()137    ax3 = plt.subplot(121)138    assert ax1 is plt.gca()139    assert ax1 is ax3...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
