How to use the parameterized.parameterized.expand function in parameterized

To help you get started, we’ve selected a few parameterized examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dwavesystems / dimod / tests / test_bqm.py View on Github external
    @parameterized.expand([(cls.__name__, cls) for cls in BQM_SUBCLASSES])
    def test_spin_spin(self, name, BQM):
        bqm = BQM(dimod.SPIN)
        self.assertIs(bqm.spin, bqm)
        self.assertIs(bqm.spin.spin, bqm)  # and so on
github awslabs / aws-sam-cli / tests / unit / lib / intrinsic_resolver / test_intrinsic_resolver.py View on Github external
    @parameterized.expand(
        [
            ("Fn::Split should fail for values that are not lists: {}".format(item), item)
            for item in [True, False, "Test", {}, 42]
        ]
    )
    def test_fn_split_arguments_invalid_formats(self, name, intrinsic):
        with self.assertRaises(InvalidIntrinsicException, msg=name):
            self.resolver.intrinsic_property_resolver({"Fn::Split": intrinsic}, True)
github ulikoehler / UliEngineering / tests / SignalProcessing / TestFilter.py View on Github external
    @parameterized.expand([
        ("lowpass", 1.0),
        ("highpass", 1.0),
        ("bandpass", [1.0, 2.0]),
        ("bandstop", [1.0, 2.0]),
    ])
    def testBasicFilter(self, btype, frequencies):
        filt = SignalFilter(100.0, frequencies, btype=btype)
        filt.iir(order=3)
        d2 = filt(self.d)
        self.assertEqual(self.d.shape, d2.shape)
github dwavesystems / dimod / tests / test_bqm.py View on Github external
    @parameterized.expand([(cls.__name__, cls) for cls in BQM_SUBCLASSES])
    def test_cross_type(self, name, BQM):
        if not BQM.shapeable():
            return

        bqm = BQM({'a': .3}, {('a', 'b'): -1}, 1.2, dimod.BINARY)
        with self.assertRaises(ValueError):
            bqm.fix_variable('a', -1)

        bqm = BQM({'a': .3}, {('a', 'b'): -1}, 1.2, dimod.SPIN)
        with self.assertRaises(ValueError):
            bqm.fix_variable('a', 0)
github hootnot / saxo_openapi / tests / test_portfolio_closedpositions.py View on Github external
    @parameterized.expand([
        (pf.closedpositions, "ClosedPositionList", {}),
        (pf.closedpositions, "ClosedPositionById",
                             {'ClosedPositionId': '212702698-212702774'}),
        (pf.closedpositions, "ClosedPositionDetails",
                             {'ClosedPositionId': '212702698-212702774'}),
        (pf.closedpositions, "ClosedPositionsMe", {}),
        (pf.closedpositions, "ClosedPositionSubscription", {}),
        (pf.closedpositions, "ClosedPositionSubscriptionUpdate",
                             {'ContextId': 'explorer_1551913039211',
                              'ReferenceId': 'D_975'}),
        (pf.closedpositions, "ClosedPositionSubscriptionsRemove",
                             {'ContextId': 29931122,
                              'params': {'Tag': 2345223}}),
        (pf.closedpositions, "ClosedPositionSubscriptionRemoveById",
         {'ContextId': 29931122,
          'ReferenceId': '0f8fad5b-d9cb-469f-a165-70867728950e'}),
github dwavesystems / dimod / tests / test_bqm.py View on Github external
    @parameterized.expand([(cls.__name__, cls) for cls in BQM_SUBCLASSES])
    def test_normalize(self, name, BQM):
        bqm = BQM({0: -2, 1: 2}, {(0, 1): -1}, 1., dimod.SPIN)
        bqm.normalize(.5)
        self.assertAlmostEqual(bqm.linear, {0: -.5, 1: .5})
        self.assertAlmostEqual(bqm.quadratic, {(0, 1): -.25})
        self.assertAlmostEqual(bqm.offset, .25)
        assert_consistent_bqm(bqm)
github Qiskit / qiskit-aqua / test / chemistry / test_initial_state_hartree_fock.py View on Github external
    @parameterized.expand([
        [QubitMappingType.JORDAN_WIGNER],
        [QubitMappingType.PARITY],
        [QubitMappingType.BRAVYI_KITAEV]
    ])
    def test_hf_value(self, mapping):
        """ hf value test """
        try:
            driver = PySCFDriver(atom='Li .0 .0 .0; H .0 .0 1.6',
                                 unit=UnitsType.ANGSTROM,
                                 charge=0,
                                 spin=0,
                                 basis='sto3g')
        except QiskitChemistryError:
            self.skipTest('PYSCF driver does not appear to be installed')
        qmolecule = driver.run()
        core = Hamiltonian(transformation=TransformationType.FULL,
github GoogleCloudPlatform / oozie-to-airflow / tests / converter / test_workflow_xml_parser.py View on Github external
    @parameterized.expand(
        [
            (
                WorkflowExpectedResult(
                    name="decision",
                    nodes={
                        "decision-node": NodeExpectedResult(downstream_names=["first", "end", "kill"]),
                        "kill": NodeExpectedResult(downstream_names=[]),
                        "end": NodeExpectedResult(downstream_names=[]),
                        "start_node_1234": NodeExpectedResult(downstream_names=["decision-node"]),
                        "first": NodeExpectedResult(downstream_names=["end"], error_xml="end"),
                    },
                    job_properties={"nameNode": "hdfs://"},
                    config={},
                ),
            ),
            (
github bsc-wdc / dislib / tests / test_array.py View on Github external
    @parameterized.expand([(np.full((10, 10), 3, complex),),
                           (sp.csr_matrix(np.full((10, 10), 5, complex)),),
                           (np.random.rand(10, 10) +
                            1j * np.random.rand(10, 10),)])
    def test_conj(self, x_np):
        """ Tests the complex conjugate """
        bs0 = np.random.randint(1, x_np.shape[0] + 1)
        bs1 = np.random.randint(1, x_np.shape[1] + 1)

        x = ds.array(x_np, (bs0, bs1))
        self.assertTrue(_equal_arrays(x.conj().collect(), x_np.conj()))