예제 #1
0
    def test_gen_iso_cool_lists2(self):
        """Test that string cooling steps are correctly accepted
        """
        isolistraw = "a, b, c,d"
        coollistraw = "1_d, 99 y"
        
        # Create placeholder for phtn_src file
        with NTF() as myNTF: 
            myNTF.write(self.NTFcontents)
            myNTF.seek(0) # Goes to beginning
            isolist, coollist = s2s.gen_iso_cool_lists(isolistraw, \
                coollistraw, myNTF.name)

        self.assertEqual(isolist, ["a", "b", "c", "d"])
        self.assertEqual(coollist, ["1_d", "99 y"])
예제 #2
0
    def test_gen_iso_cool_lists4(self):
        """Test getting string cooling times from phtn_src file w/out of order cooling numbers.
        """
        isolistraw = "a, b, c, d"
        coollistraw = "3, 1, 0, 2"

        # Create placeholder for phtn_src file
        with NTF() as myNTF:
            myNTF.write(self.NTFcontents)
            myNTF.seek(0) # Goes to beginning
            isolist, coollist = s2s.gen_iso_cool_lists(isolistraw, \
                coollistraw, myNTF.name)

        self.assertEqual(isolist, ["a", "b", "c", "d"])
        self.assertEqual(coollist, ["shutdown", "1_d", "2 w", "99 y"])
예제 #3
0
    def test_gen_iso_cool_lists1(self):
        """Test parsing of non-numeric entries in isotopes and cooling input.
        Varied spacing is intentional.
        """
        isolistraw = "a, b, c,d"
        coollistraw = "1,2,   3, 4"#"x, y,z,1 z"
        
        # Create placeholder for phtn_src file
        with NTF() as myNTF: 
            myNTF.write(self.NTFcontents)
            myNTF.seek(0) # Goes to beginning
            isolist, coollist = s2s.gen_iso_cool_lists(isolistraw, \
                coollistraw, myNTF.name)

        self.assertEqual(isolist, ["a", "b", "c", "d"])
        self.assertEqual(coollist, ["1_d", "2 w", "99 y", "whoops"])
예제 #4
0
    def test_gen_iso_cool_lists7(self):
        """Test that 'all' results in all cooling steps being grabbed.
        """
        isolistraw = "a, b, c, d"
        coollistraw = "all"

        # Create placeholder for phtn_src file
        with NTF() as myNTF: 
            myNTF.write(self.NTFcontents)
            myNTF.seek(0) # Goes to beginning
            isolist, coollist = s2s.gen_iso_cool_lists(isolistraw, \
                coollistraw, myNTF.name)

        self.assertEqual(isolist, ["a", "b", "c", "d"])
        self.assertEqual(coollist, ["shutdown", "1_d", "2 w", "99 y", \
                "whoops", "too far"])