def test__get_end_branch_export_path_two_gsim_bls(self): # Same test as above but with multiple GSIM branching levels # In this case, we have two branching levels in the GSIM logic tree. # The GSIM names should be joined on a `_` to form the directory name. class FakeGMPE2(object): pass b2 = self.FakeGMPELTBranch() b2.value = FakeGMPE2() self.ltp.gmpe_lt.branches['b2'] = b2 self.lt_rlz.gsim_lt_path.append('b2') # PGA: result = self.FakeResult(self.lt_rlz, 'PGA', None) expected = '/tmp/oq/FakeGMPE_FakeGMPE2/PGA' actual = hazard._get_end_branch_export_path( self.target_dir, result, self.ltp ) self.assertEqual(expected, actual) # SA: result = self.FakeResult(self.lt_rlz, 'SA', '0.025') expected = '/tmp/oq/FakeGMPE_FakeGMPE2/SA[0025]' actual = hazard._get_end_branch_export_path( self.target_dir, result, self.ltp ) self.assertEqual(expected, actual)
def test__get_end_branch_export_path_one_gsim_bl(self): # Test with one GSIM branching level # PGA: result = self.FakeResult(self.lt_rlz, 'PGA', None) expected = '/tmp/oq/FakeGMPE/PGA' actual = hazard._get_end_branch_export_path( self.target_dir, result, self.ltp ) self.assertEqual(expected, actual) # SA: result = self.FakeResult(self.lt_rlz, 'SA', '0.025') expected = '/tmp/oq/FakeGMPE/SA[0025]' actual = hazard._get_end_branch_export_path( self.target_dir, result, self.ltp ) self.assertEqual(expected, actual)