Esempio n. 1
0
    def deck_calibration_test(self):
        """
        Verify calibration offsets.
        """

        config = {
            'calibration': {
                'a1': {
                    'type': 'tiprack_P2',
                    'x': 10,
                    'y': 11,
                    'z': 12
                }
            }
        }

        deck = Deck(a1=tipracks.Tiprack())
        deck.configure(config)

        margin = self.expected_margin

        rack = deck.slot('a1')

        a1 = rack.tip('a1').coordinates()
        b2 = rack.tip('b2').coordinates()

        self.assertEqual(a1, (10, 11, 12))
        self.assertEqual(b2, (10 + margin, 11 + margin, 12))
Esempio n. 2
0
    def deck_calibration_test(self):
        """
        Deck calibration.
        """
        config = {
            'calibration': {
                'a1': {
                    'type': 'reservoir',
                    'x': 10,
                    'y': 11,
                    'z': 12
                }
            }
        }

        deck = Deck(a1=Reservoir())
        deck.configure(config)

        margin = self.expected_margin

        reservoir = deck.slot('a1')

        col1 = reservoir.row(1).coordinates()
        col2 = reservoir.row(2).coordinates()

        self.assertEqual(col1, (10, 11, 12))
        self.assertEqual(col2, (10, 11 + margin, 12))
Esempio n. 3
0
    def deck_calibration_test(self):
        """Calibrates through deck."""
        config = {
            'calibration': {
                'a1': {
                    'type': 'microplate_96',
                    'x': 10,
                    'y': 11,
                    'z': 12
                }
            }
        }

        deck = Deck(a1=Microplate())
        deck.configure(config)

        margin = self.expected_margin

        plate = deck.slot('a1')

        a1 = plate.well('a1').coordinates()
        b2 = plate.well('b2').coordinates()

        self.assertEqual(a1, (10, 11, 12))
        self.assertEqual(b2, (10 + margin, 11 + margin, 12))
Esempio n. 4
0
 def test_address(self):
     """ Address. """
     plate = Microplate()
     self.assertEqual(plate.well('A1').address, [(0, 0)])
     self.assertEqual(plate.well('a1').human_address, 'A1')
     deck = Deck()
     deck.add_module('A1', 'microplate')
     well = deck.slot('A1').well('B4')
     self.assertEqual(well.human_address, 'A1:B4')
     self.assertEqual(well.address, [(0, 0), (1, 3)])
Esempio n. 5
0
 def setUp(self):
     self.deck = Deck()
Esempio n. 6
0
class DeckTest(unittest.TestCase):
    def setUp(self):
        self.deck = Deck()

    def test_module_add(self):
        """Add a module to the deck."""
        self.deck.add_modules(a1=Microplate())
        plate = self.deck.slot('a1')
        self.assertTrue(isinstance(plate, Microplate))

    def test_module_add_by_container_name(self):
        """ Add a module to deck by container name. """
        self.deck.add_module('a1', 'microplate.96')
        plate = self.deck.slot('a1')
        self.assertTrue(isinstance(plate, Microplate))

    def test_modules_add_by_container_name(self):
        """ Add modules to deck by container name. """
        self.deck.add_modules(a1='microplate.96', a2='microplate.96.deepwell')
        self.assertEqual(self.deck.slot('a1').name, 'microplate.96')
        self.assertEqual(self.deck.slot('a2').name, 'microplate.96.deepwell')

    def test_module_add_to_filled_slot(self):
        """Raise when adding module to filled deck slot."""
        self.deck.add_modules(a1=Microplate())
        with self.assertRaises(x.ContainerConflict):
            self.deck.add_modules(a1=Microplate())

    def test_module_access_empty_slot(self):
        """Raise when accessing empty deck slot."""
        with self.assertRaises(x.ContainerMissing):
            self.deck.slot('a1')

    def test_slot_out_of_range(self):
        """Raise when accessing out-of-range deck slot."""
        with self.assertRaises(x.SlotMissing):
            self.deck.slot('z1')

    def test_find_module(self):
        self.deck.add_module('a1', 'microplate.96')
        plate = self.deck.find_module(name='microplate.96')
        self.assertIsInstance(plate, Microplate)
        self.deck.add_module('a2', 'tiprack.p10')
        rack = self.deck.find_module(size='P10')
        self.assertIsInstance(rack, Tiprack)

    def test_module_address(self):
        """ Return module address as list of tuples. """
        self.deck.add_module('B3', 'microplate.96')
        slot = self.deck.slot('B3')
        well = slot.well('H2')
        self.assertEqual(slot.address, [(1, 2)])
        self.assertEqual(well.address, [(1, 2), (7, 1)])
Esempio n. 7
0
 def setUp(self):
     self.deck = Deck()
Esempio n. 8
0
class DeckTest(unittest.TestCase):

    def setUp(self):
        self.deck = Deck()

    def test_module_add(self):
        """Add a module to the deck."""
        self.deck.add_modules(a1=Microplate())
        plate = self.deck.slot('a1')
        self.assertTrue(isinstance(plate, Microplate))

    def test_module_add_by_container_name(self):
        """ Add a module to deck by container name. """
        self.deck.add_module('a1', 'microplate.96')
        plate = self.deck.slot('a1')
        self.assertTrue(isinstance(plate, Microplate))

    def test_modules_add_by_container_name(self):
        """ Add modules to deck by container name. """
        self.deck.add_modules(
            a1='microplate.96',
            a2='microplate.96.deepwell'
        )
        self.assertEqual(self.deck.slot('a1').name, 'microplate.96')
        self.assertEqual(self.deck.slot('a2').name, 'microplate.96.deepwell')

    def test_module_add_to_filled_slot(self):
        """Raise when adding module to filled deck slot."""
        self.deck.add_modules(a1=Microplate())
        with self.assertRaises(x.ContainerConflict):
            self.deck.add_modules(a1=Microplate())

    def test_module_access_empty_slot(self):
        """Raise when accessing empty deck slot."""
        with self.assertRaises(x.ContainerMissing):
            self.deck.slot('a1')

    def test_slot_out_of_range(self):
        """Raise when accessing out-of-range deck slot."""
        with self.assertRaises(x.SlotMissing):
            self.deck.slot('z1')

    def test_find_module(self):
        self.deck.add_module('a1', 'microplate.96')
        plate = self.deck.find_module(name='microplate.96')
        self.assertIsInstance(plate, Microplate)
        self.deck.add_module('a2', 'tiprack.p10')
        rack = self.deck.find_module(size='P10')
        self.assertIsInstance(rack, Tiprack)

    def test_module_address(self):
        """ Return module address as list of tuples. """
        self.deck.add_module('B3', 'microplate.96')
        slot = self.deck.slot('B3')
        well = slot.well('H2')
        self.assertEqual(slot.address, [(1, 2)])
        self.assertEqual(well.address, [(1, 2), (7, 1)])