def test_component_instantiate_resonator_rectangle_spiral(self): """Test the instantiation of ResonatorRectangleSpiral.""" design = designs.DesignPlanar() try: ResonatorRectangleSpiral except Exception: self.fail("ResonatorRectangleSpiral failed") try: ResonatorRectangleSpiral(design, "my_name") except Exception: self.fail("ResonatorRectangleSpiral(design, \"my_name\")") try: ResonatorRectangleSpiral(design, "my_name2", options={}) except Exception: self.fail( "ResonatorRectangleSpiral(design, \"my_name2\", options={})") try: ResonatorRectangleSpiral(design, "my_name3", options={}, make=False) except Exception: self.fail( "ResonatorRectangleSpiral(design, \"my_name3\", options={}, make=False)" )
def test_design_default_component_name(self): """Test automatic naming of components.""" design = DesignPlanar(metadata={}) ResonatorRectangleSpiral(design, make=False) self.assertEqual('res_1' in design.components, True) ResonatorRectangleSpiral(design, make=False) self.assertEqual('res_2' in design.components, True) # Manually add the next automatic name to check it doesn't get repeated ResonatorRectangleSpiral(design, 'res_3', make=False) ResonatorRectangleSpiral(design, make=False) self.assertEqual('res_3' in design.components, True) self.assertEqual('res_4' in design.components, True) # Add a different component TransmonPocket(design, make=False) self.assertEqual('Q_1' in design.components, False) # Add a component with no predefined prefix QComponent(design, make=False) self.assertEqual('QComponent_1' in design.components, True)
def test_component_resonator_rectangle_spiral_options(self): """Test that default options of ResonatorRectangleSpiral in resonator_rectangle_spiral.py were not accidentally changed.""" # Setup expected test results design = designs.DesignPlanar() resonator_rectangle_spiral = ResonatorRectangleSpiral(design, 'my_name') options = resonator_rectangle_spiral.default_options # Test all elements of the result data against expected data self.assertEqual(len(options), 11) self.assertEqual(options['n'], '3') self.assertEqual(options['length'], '2000um') self.assertEqual(options['line_width'], '1um') self.assertEqual(options['height'], '40um') self.assertEqual(options['gap'], '4um') self.assertEqual(options['coupler_distance'], '10um') self.assertEqual(options['pos_x'], '0um') self.assertEqual(options['pos_y'], '0um') self.assertEqual(options['rotation'], '0') self.assertEqual(options['chip'], 'main') self.assertEqual(options['layer'], '1')