File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ def matplotlib(self, line=''):
100100 % _list_matplotlib_backends_and_gui_loops ()
101101 )
102102 else :
103- gui , backend = self .shell .enable_matplotlib (args .gui . lower () if isinstance ( args . gui , str ) else args . gui )
103+ gui , backend = self .shell .enable_matplotlib (args .gui )
104104 self ._show_matplotlib_backend (args .gui , backend )
105105
106106 @skip_doctest
Original file line number Diff line number Diff line change @@ -350,3 +350,27 @@ def test_backend_entry_point():
350350def test_backend_unknown ():
351351 with pytest .raises (RuntimeError if pt ._matplotlib_manages_backends () else KeyError ):
352352 pt .find_gui_and_backend ("name-does-not-exist" )
353+
354+
355+ @dec .skipif (not pt ._matplotlib_manages_backends ())
356+ def test_backend_module_name_case_sensitive ():
357+ # Matplotlib backend names are case insensitive unless explicitly specified using
358+ # "module://some_module.some_name" syntax which are case sensitive for mpl >= 3.9.1
359+ all_lowercase = "module://matplotlib_inline.backend_inline"
360+ some_uppercase = "module://matplotlib_inline.Backend_inline"
361+ ip = get_ipython ()
362+ mpl3_9_1 = matplotlib .__version_info__ >= (3 , 9 , 1 )
363+
364+ ip .enable_matplotlib (all_lowercase )
365+ if mpl3_9_1 :
366+ with pytest .raises (RuntimeError ):
367+ ip .enable_matplotlib (some_uppercase )
368+ else :
369+ ip .enable_matplotlib (some_uppercase )
370+
371+ ip .run_line_magic ("matplotlib" , all_lowercase )
372+ if mpl3_9_1 :
373+ with pytest .raises (RuntimeError ):
374+ ip .run_line_magic ("matplotlib" , some_uppercase )
375+ else :
376+ ip .run_line_magic ("matplotlib" , some_uppercase )
You can’t perform that action at this time.
0 commit comments