def test_get_env_method_will_return_desired_environment_even_with_custom_formats(self): """testing if ExternalEnvFactory.get_env() will return desired ExternalEnvironment instance even with names like "MudBox (.mud)" """ ext_env_factory = ExternalEnvFactory() name_format = "(%e) - %n" # photoshop = ext_env_factory.get_env('(.psd) - Photoshop', # name_format=name_format) # self.assertIsInstance(photoshop, ExternalEnv) # self.assertEqual(photoshop.name, 'Photoshop') # self.assertEqual(photoshop.extension, '.psd') # self.assertEqual(photoshop.structure, ['Outputs']) zbrush = ext_env_factory.get_env("(.ztl) ZBrush", name_format=name_format) self.assertTrue(isinstance(zbrush, ExternalEnv)) self.assertEqual(zbrush.name, "ZBrush") self.assertEqual(zbrush.extensions, [".ztl"]) self.assertEqual(zbrush.structure, ["Outputs"]) mudbox = ext_env_factory.get_env("(.mud) MudBox", name_format=name_format) self.assertTrue(isinstance(mudbox, ExternalEnv)) self.assertEqual(mudbox.name, "MudBox") self.assertEqual(mudbox.extensions, [".mud"]) self.assertEqual(mudbox.structure, ["Outputs"])
def test_get_env_method_will_return_desired_environment_even_with_custom_formats( self): """testing if ExternalEnvFactory.get_env() will return desired ExternalEnvironment instance even with names like "MudBox (.mud)" """ ext_env_factory = ExternalEnvFactory() name_format = '(%e) - %n' #photoshop = ext_env_factory.get_env('(.psd) - Photoshop', # name_format=name_format) #self.assertIsInstance(photoshop, ExternalEnv) #self.assertEqual(photoshop.name, 'Photoshop') #self.assertEqual(photoshop.extension, '.psd') #self.assertEqual(photoshop.structure, ['Outputs']) zbrush = ext_env_factory.get_env('(.ztl) ZBrush', name_format=name_format) self.assertTrue(isinstance(zbrush, ExternalEnv)) self.assertEqual(zbrush.name, 'ZBrush') self.assertEqual(zbrush.extensions, ['.ztl']) self.assertEqual(zbrush.structure, ['Outputs']) mudbox = ext_env_factory.get_env('(.mud) MudBox', name_format=name_format) self.assertTrue(isinstance(mudbox, ExternalEnv)) self.assertEqual(mudbox.name, 'MudBox') self.assertEqual(mudbox.extensions, ['.mud']) self.assertEqual(mudbox.structure, ['Outputs'])
def test_get_env_names_method_will_return_all_environment_names_properly(self): """testing if ExternalEnvFactory.get_env_names() method will return all the environment names as a list of strings """ from anima.env.external import external_environments expected_result = external_environments.keys() ext_env_factory = ExternalEnvFactory() result = ext_env_factory.get_env_names() self.assertEqual(expected_result, result)
def test_get_env_names_method_will_return_complex_environment_names_properly(self): """testing if ExternalEnvFactory.get_env_names() method will return all the environment names as a list of strings in desired format when environment_name_format is set """ name_format = "%e - %n" expected_result = [ ".ztl - ZBrush", ".mud - MudBox", #'.psd - Photoshop' ] ext_env_factory = ExternalEnvFactory() result = ext_env_factory.get_env_names(name_format=name_format) self.assertEqual(sorted(expected_result), sorted(result))
def test_get_env_names_method_will_return_complex_environment_names_properly(self): """testing if ExternalEnvFactory.get_env_names() method will return all the environment names as a list of strings in desired format when environment_name_format is set """ name_format = '%e - %n' expected_result = [ '.ztl - ZBrush', '.mud - MudBox', #'.psd - Photoshop' ] ext_env_factory = ExternalEnvFactory() result = ext_env_factory.get_env_names(name_format=name_format) self.assertEqual(sorted(expected_result), sorted(result))
def test_get_env_method_will_return_desired_environment(self): """testing if ExternalEnvFactory.get_env() will return desired ExternalEnvironment instance """ ext_env_factory = ExternalEnvFactory() # photoshop = ext_env_factory.get_env('Photoshop') # self.assertIsInstance(photoshop, ExternalEnv) # self.assertEqual(photoshop.name, 'Photoshop') # self.assertEqual(photoshop.extension, '.psd') # self.assertEqual(photoshop.structure, ['Outputs']) zbrush_tool = ext_env_factory.get_env("ZBrush") self.assertTrue(isinstance(zbrush_tool, ExternalEnv)) self.assertEqual(zbrush_tool.name, "ZBrush") self.assertEqual(zbrush_tool.extensions, [".ztl"]) self.assertEqual(zbrush_tool.structure, ["Outputs"]) mudbox = ext_env_factory.get_env("MudBox") self.assertTrue(isinstance(mudbox, ExternalEnv)) self.assertEqual(mudbox.name, "MudBox") self.assertEqual(mudbox.extensions, [".mud"]) self.assertEqual(mudbox.structure, ["Outputs"])
def test_get_env_method_will_return_desired_environment(self): """testing if ExternalEnvFactory.get_env() will return desired ExternalEnvironment instance """ ext_env_factory = ExternalEnvFactory() #photoshop = ext_env_factory.get_env('Photoshop') #self.assertIsInstance(photoshop, ExternalEnv) #self.assertEqual(photoshop.name, 'Photoshop') #self.assertEqual(photoshop.extension, '.psd') #self.assertEqual(photoshop.structure, ['Outputs']) zbrush_tool = ext_env_factory.get_env('ZBrush') self.assertTrue(isinstance(zbrush_tool, ExternalEnv)) self.assertEqual(zbrush_tool.name, 'ZBrush') self.assertEqual(zbrush_tool.extensions, ['.ztl']) self.assertEqual(zbrush_tool.structure, ['Outputs']) mudbox = ext_env_factory.get_env('MudBox') self.assertTrue(isinstance(mudbox, ExternalEnv)) self.assertEqual(mudbox.name, 'MudBox') self.assertEqual(mudbox.extensions, ['.mud']) self.assertEqual(mudbox.structure, ['Outputs'])
def test_get_env_method_name_is_not_in_list(self): """testing if a ValueError will be raised when the name argument value is not in the anima.env.external_environments list """ ext_env_factory = ExternalEnvFactory() self.assertRaises(ValueError, ext_env_factory.get_env, 'Modo')
def test_get_env_method_name_argument_is_not_a_string(self): """testing if a TypeError will be raised when the name argument is not a string in ExternalEnvironmentFactory.get_env() method """ ext_env_factory = ExternalEnvFactory() self.assertRaises(TypeError, ext_env_factory.get_env, 234)