<s> """<STR_LIT>""" <EOL> import os <EOL> import shutil <EOL> import unittest <EOL> import tempfile <EOL> import numpy <EOL> from PIL import Image <EOL> from mayavi import mlab <EOL> from common import TestCase <EOL> class TestText3DUnitTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . temp_dir = tempfile . mkdtemp ( ) <EOL> self . filename = os . path . join ( self . temp_dir , "<STR_LIT>" ) <EOL> self . addCleanup ( self . remove_tempdir ) <EOL> def remove_tempdir ( self ) : <EOL> shutil . rmtree ( self . temp_dir ) <EOL> def mlab_close_all ( self ) : <EOL> mlab . close ( all = True ) <EOL> def test_text3d ( self ) : <EOL> """<STR_LIT>""" <EOL> mlab . points3d ( <NUM_LIT:0.> , <NUM_LIT:0.> , <NUM_LIT:0.> , opacity = <NUM_LIT:0.> ) <EOL> self . addCleanup ( self . mlab_close_all ) <EOL> mlab . text3d ( <NUM_LIT:0.> , <NUM_LIT:0.> , <NUM_LIT:0.> , "<STR_LIT:X>" ) <EOL> mlab . savefig ( self . filename ) <EOL> self . check ( ) <EOL> def check ( self ) : <EOL> image = numpy . array ( Image . open ( self . filename ) ) [ : , : , : <NUM_LIT:3> ] <EOL> if not ( numpy . sum ( image != image [ <NUM_LIT:0> , <NUM_LIT:0> ] , axis = <NUM_LIT:2> ) == <NUM_LIT:3> ) . any ( ) : <EOL> message = "<STR_LIT>" <EOL> self . fail ( message ) <EOL> class TestText3D ( TestCase ) : <EOL> def test ( self ) : <EOL> self . main ( ) <EOL> def do ( self ) : <EOL> suite = unittest . TestLoader ( ) . loadTestsFromTestCase ( <EOL> TestText3DUnitTest ) <EOL> unittest . TextTestRunner ( ) . run ( suite ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> t = TestText3D ( ) <EOL> t . test ( ) </s>
