<s> from genty import genty , genty_dataset <EOL> from os . path import expanduser , join <EOL> from app . master . build_artifact import BuildArtifact <EOL> from app . util . conf . configuration import Configuration <EOL> from test . framework . base_unit_test_case import BaseUnitTestCase <EOL> @ genty <EOL> class TestBuildArtifact ( BaseUnitTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( ) . setUp ( ) <EOL> Configuration [ '<STR_LIT>' ] = expanduser ( '<STR_LIT>' ) <EOL> @ genty_dataset ( <EOL> happy_path_all_args = ( join ( expanduser ( '<STR_LIT>' ) , '<STR_LIT:1>' , '<STR_LIT>' ) , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) , <EOL> override_result_root = ( join ( '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' ) , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , join ( '<STR_LIT>' ) ) , <EOL> just_build_directory = ( join ( expanduser ( '<STR_LIT>' ) , '<STR_LIT:1>' ) , <NUM_LIT:1> , None , None ) , <EOL> build_directory_with_override = ( join ( '<STR_LIT>' , '<STR_LIT:1>' ) , <NUM_LIT:1> , None , None , join ( '<STR_LIT>' ) ) , <EOL> ) <EOL> def test_artifact_directory_returns_proper_artifact_path ( self , expected_path , build_id , subjob_id = None , <EOL> atom_id = None , result_root = None ) : <EOL> self . assertEquals ( <EOL> expected_path , <EOL> BuildArtifact . _artifact_directory ( build_id , subjob_id , atom_id , result_root = result_root ) , <EOL> '<STR_LIT>' <EOL> ) <EOL> @ genty_dataset ( <EOL> subjob_no_atom = ( <NUM_LIT:1> , None ) , <EOL> atom_no_subjob = ( None , <NUM_LIT:1> ) , <EOL> ) <EOL> def test_artifact_directory_raises_value_error_if_subjob_id_or_atom_id_specified ( self , subjob_id , atom_id ) : <EOL> with self . assertRaises ( ValueError ) : <EOL> BuildArtifact . _artifact_directory ( <NUM_LIT:1> , subjob_id , atom_id ) <EOL> @ genty_dataset ( <EOL> relative_path = ( '<STR_LIT>' , <NUM_LIT:0> , <NUM_LIT:1> ) , <EOL> absolute_path = ( '<STR_LIT>' , <NUM_LIT:0> , <NUM_LIT:1> ) , <EOL> ) <EOL> def test_subjob_and_atom_ids_parses_for_properly_formatted_directory ( self , artifact_directory , expected_subjob_id , <EOL> expected_atom_id ) : <EOL> subjob_id , atom_id = BuildArtifact . _subjob_and_atom_ids ( artifact_directory ) <EOL> self . assertEquals ( subjob_id , expected_subjob_id ) <EOL> self . assertEquals ( atom_id , expected_atom_id ) <EOL> @ genty_dataset ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> def test_subjob_and_atom_ids_raises_value_error_with_incorrect_format ( self , incorrect_artifact_directory ) : <EOL> with self . assertRaises ( ValueError ) : <EOL> BuildArtifact . _subjob_and_atom_ids ( incorrect_artifact_directory ) </s>
