def testPersistence( self ):

      mgr = MyStyleManager()

      style1 = mgr.create( 'Style_#1' )
      style1.figure.text.size = 12
      style1.axes.text.size = 8

      mgr.save( outdir = self.outputDir )

      self.assertRaises( Exception, mgr.save, outdir=self.outputDir, overwrite=False,
                   msg = "Failed to raise when writing to an existing file." )

      mgr2 = MyStyleManager()
      mgr2.load()
      self.checkStyleEq( "Default Load", style1, mgr2[ style1.name ] )

      mgr3 = MyStyleManager()
      mgr3.path = [ self.outputDir ]
      mgr3.load()
      self.checkStyleEq( "Load by path", style1, mgr3[ style1.name ] )

      mgr4 = MyStyleManager()
      mgr4.path = [ '$STYLEPATH' ]
      mgr4.load()
      self.checkStyleEq( "Load by path STYLEPATH", style1, mgr4[ style1.name ] )

      mgr5 = MyStyleManager()
      mgr5.load( self.outputDir )
      self.checkStyleEq( "Load by passed path", style1, mgr5[ style1.name ] )

      os.environ.pop( "STYLEPATH" )
      mgr6 = MyStyleManager()
      mgr6.load()

      self.assertEqual( None, mgr6.find( style1.name ),
               msg = "There should be not style loaded." )

      p = path( self.outputFile( 'Style_#1.testyle' ) )
      self.assertEqual( True, p.exists(),
               msg = "Manager failed to write the style file." )

      mgr.erase( style1, delete = True )
      self.assertEqual( False, p.exists(),
               msg = "Manager failed to remove the style file." )

   #-----------------------------------------------------------------------
Test reading and writing functionality.
dataset/ETHPy150Open nasa/mplStyle/mplStyle/types/test/test_StyleManager.py/TestStyleManager.testPersistence