Example #1
0
    def setUp(self):
        hop = Hop()
        hop.counts = 10
        hop.settle = 3
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H2', isotope='Ar39')
        hop.positions = [p1, p2]

        hop2 = Hop()
        hop2.counts = 100
        hop2.settle = 30
        p1 = Position(detector='L1', isotope='Ar40')
        p2 = Position(detector='L2', isotope='Ar39')
        hop2.positions = [p1, p2]

        self.hop_sequence = HopSequence(hops=[hop, hop2])
Example #2
0
class HopTestCase(unittest.TestCase):
    def setUp(self):
        self.hop = Hop()

    def test_validate_hop_fail(self):
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H2', isotope='Ar40')
        self.hop.positions = [p1, p2]

        self.assertEqual(self.hop.validate_hop(), False)
        self.assertEqual(self.hop.error_message, 'Multiple Isotopes: Ar40')

    def test_validate_hop_fail2(self):
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H1', isotope='Ar39')
        self.hop.positions = [p1, p2]

        self.assertEqual(self.hop.validate_hop(), False)
        self.assertEqual(self.hop.error_message, 'Multiple Detectors: H1')

    def test_validate_hop_fail3(self):
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H1', isotope='Ar39')
        p3 = Position(detector='H2', isotope='Ar40')
        p4 = Position(detector='H2', isotope='Ar39')
        self.hop.positions = [p1, p2, p3, p4]

        self.assertEqual(self.hop.validate_hop(), False)
        self.assertEqual(
            self.hop.error_message,
            'Multiple Isotopes: Ar40, Ar39; Multiple Detectors: H1, H2')

    def test_validate_hop_pass(self):
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H2', isotope='Ar39')
        self.hop.positions = [p1, p2]

        self.assertEqual(self.hop.validate_hop(), True)
        self.assertEqual(self.hop.error_message, '')

    def test_to_string(self):
        self.hop.counts = 10
        self.hop.settle = 3
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H2', isotope='Ar39')
        self.hop.positions = [p1, p2]

        self.assertEqual(self.hop.to_string(), "('Ar40:H1, Ar39:H2', 10, 3)")

    def test_parse_hopstr(self):
        hs = 'Ar40:H1:10,     Ar39:AX,     Ar36:CDD'

        self.hop.parse_hopstr(hs)
        self.assertEqual(len(self.hop.positions), 3)
Example #3
0
    def setUp(self):
        hop = Hop()
        hop.counts = 10
        hop.settle = 3
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H2', isotope='Ar39')
        hop.positions = [p1, p2]

        hop2 = Hop()
        hop2.counts = 100
        hop2.settle = 30
        p1 = Position(detector='L1', isotope='Ar40')
        p2 = Position(detector='L2', isotope='Ar39')
        hop2.positions = [p1, p2]

        self.hop_sequence = HopSequence(hops=[hop, hop2])
Example #4
0
class HopTestCase(unittest.TestCase):
    def setUp(self):
        self.hop = Hop()

    def test_validate_hop_fail(self):
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H2', isotope='Ar40')
        self.hop.positions = [p1, p2]

        self.assertEqual(self.hop.validate_hop(), False)
        self.assertEqual(self.hop.error_message, 'Multiple Isotopes: Ar40')

    def test_validate_hop_fail2(self):
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H1', isotope='Ar39')
        self.hop.positions = [p1, p2]

        self.assertEqual(self.hop.validate_hop(), False)
        self.assertEqual(self.hop.error_message, 'Multiple Detectors: H1')

    def test_validate_hop_fail3(self):
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H1', isotope='Ar39')
        p3 = Position(detector='H2', isotope='Ar40')
        p4 = Position(detector='H2', isotope='Ar39')
        self.hop.positions = [p1, p2, p3, p4]

        self.assertEqual(self.hop.validate_hop(), False)
        self.assertEqual(self.hop.error_message, 'Multiple Isotopes: Ar40, Ar39; Multiple Detectors: H1, H2')

    def test_validate_hop_pass(self):
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H2', isotope='Ar39')
        self.hop.positions = [p1, p2]

        self.assertEqual(self.hop.validate_hop(), True)
        self.assertEqual(self.hop.error_message, '')

    def test_to_string(self):
        self.hop.counts = 10
        self.hop.settle = 3
        p1 = Position(detector='H1', isotope='Ar40')
        p2 = Position(detector='H2', isotope='Ar39')
        self.hop.positions = [p1, p2]

        self.assertEqual(self.hop.to_string(), "('Ar40:H1, Ar39:H2', 10, 3)")

    def test_parse_hopstr(self):
        hs = 'Ar40:H1:10,     Ar39:AX,     Ar36:CDD'

        self.hop.parse_hopstr(hs)
        self.assertEqual(len(self.hop.positions), 3)
Example #5
0
 def setUp(self):
     self.hop = Hop()
Example #6
0
 def setUp(self):
     self.hop = Hop()