How to use parameterized - 10 common examples

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 Qiskit / qiskit-aqua / test / aqua / test_mct.py View on Github external
    @parameterized.expand(
        itertools.product(nums_controls, clean_ancilla_modes)
    )
    def test_mct_with_clean_ancillae(self, num_controls, mode):
        c = QuantumRegister(num_controls, name='c')
        o = QuantumRegister(1, name='o')
        qc = QuantumCircuit(o, c)
        num_ancillae = 0 if num_controls <= 2 else num_controls - 2
        if num_ancillae > 0:
            a = QuantumRegister(num_ancillae, name='a')
            qc.add_register(a)
        qc.h(c)
        qc.mct(
            [c[i] for i in range(num_controls)],
            o[0],
            [a[i] for i in range(num_ancillae)],
            mode=mode
github scrapinghub / dateparser / tests / test_freshness_date_parser.py View on Github external
        param('yesterday', ago={'days': 1}, period='day'),
        param('the day before yesterday', ago={'days': 2}, period='day'),
        param('today', ago={'days': 0}, period='day'),
        param('an hour ago', ago={'hours': 1}, period='day'),
        param('about an hour ago', ago={'hours': 1}, period='day'),
        param('a day ago', ago={'days': 1}, period='day'),
        param('a week ago', ago={'weeks': 1}, period='week'),
        param('2 hours ago', ago={'hours': 2}, period='day'),
        param('about 23 hours ago', ago={'hours': 23}, period='day'),
        param('1 year 2 months', ago={'years': 1, 'months': 2}, period='month'),
        param('1 year, 09 months,01 weeks', ago={'years': 1, 'months': 9, 'weeks': 1}, period='week'),
        param('1 year 11 months', ago={'years': 1, 'months': 11}, period='month'),
        param('1 year 12 months', ago={'years': 1, 'months': 12}, period='month'),
        param('15 hr', ago={'hours': 15}, period='day'),
        param('15 hrs', ago={'hours': 15}, period='day'),
        param('2 min', ago={'minutes': 2}, period='day'),
        param('2 mins', ago={'minutes': 2}, period='day'),
github scrapinghub / dateparser / tests / test_freshness_date_parser.py View on Github external
        param('Dans environ 23 heures', in_future={'hours': 23}, period='day'),
        param('Dans 1 an 2 mois', in_future={'years': 1, 'months': 2}, period='month'),
        param('En 1 année, 09 mois, 01 semaines',
              in_future={'years': 1, 'months': 9, 'weeks': 1}, period='week'),
        param('Dans 1 an 11 mois', in_future={'years': 1, 'months': 11}, period='month'),
        param('Dans 1 année, 1 mois, 1 semaine, 1 jour, 1 heure et 1 minute',
              in_future={'years': 1, 'months': 1, 'weeks': 1, 'days': 1, 'hours': 1, 'minutes': 1},
              period='day'),
        param('Dans 40 min', in_future={'minutes': 40}, period='day'),

        # German dates
        param('Heute', in_future={'days': 0}, period='day'),
        param('Morgen', in_future={'days': 1}, period='day'),
        param('in einem Tag', in_future={'days': 1}, period='day'),
        param('in einer Stunde', in_future={'hours': 1}, period='day'),
        param('in 2 Stunden', in_future={'hours': 2}, period='day'),
        param('in etwa 23 Stunden', in_future={'hours': 23}, period='day'),
github scrapinghub / dateparser / tests / test_freshness_date_parser.py View on Github external
        param("за 2 месеци", in_future={'months': 2}, period='month'),
        # ml
        param("5 ആഴ്ചയിൽ", in_future={'weeks': 5}, period='week'),
        param("8 മിനിറ്റിൽ", in_future={'minutes': 8}, period='day'),
        # mn
        param("10 сарын дараа", in_future={'months': 10}, period='month'),
        param("15 цагийн дараа", in_future={'hours': 15}, period='day'),
        # mr
        param("2 महिन्यांमध्ये", in_future={'months': 2}, period='month'),
        param("15 मिनि मध्ये", in_future={'minutes': 15}, period='day'),
        # ms
        param("dalam 6 jam", in_future={'hours': 6}, period='day'),
        param("dalam 11 thn", in_future={'years': 11}, period='year'),
        # my
        param("12 လအတွင်း", in_future={'months': 12}, period='month'),
        param("8 နာရီအတွင်း", in_future={'hours': 8}, period='day'),
        # nb
github scrapinghub / dateparser / tests / test_languages.py View on Github external
        param('en', {}),

    ])
    def test_validate_pertain_list_when_absent(self, lang_id, lang_info):
        result = self.validator._validate_pertain_list(lang_id, lang_info)
        self.assertTrue(result)
github scrapinghub / dateparser / tests / test_languages.py View on Github external
        param('ksb', "keloi", "in 1 day"),
        param('ksb', "evi eo", "0 day ago"),
        # ksf
        param('ksf', "ridúrǝ́", "in 1 day"),
        param('ksf', "rinkɔɔ́", "1 day ago"),
        # ksh
        param('ksh', "nächste woche", "in 1 week"),
        param('ksh', "en 3 johre", "in 3 year"),
        param('ksh', "diese mohnd", "0 month ago"),
        # ky
        param('ky', "ушул мүнөттө", "0 minute ago"),
        param('ky', "6 айд кийин", "in 6 month"),
        param('ky', "5 мүнөт мурун", "5 minute ago"),
        # lag
        param('lag', "lamʉtoondo", "in 1 day"),
        param('lag', "niijo", "1 day ago"),
        # lb
github scrapinghub / dateparser / tests / test_languages.py View on Github external
        param('ebu', "ĩgoro", "1 day ago"),
        param('ebu', "2 ndagĩka", "2 minute"),
        param('ebu', "rũciũ", "in 1 day"),
        # ee
        param('ee', "ɣleti si va yi", "1 month ago"),
        param('ee', "ƒe 24 si wo va yi", "24 year ago"),
        param('ee', "le sekend 20 me", "in 20 second"),
        # el
        param('el', "πριν από 45 λεπτό", "45 minute ago"),
        param('el', "σε 22 μήνες", "in 22 month"),
        param('el', "επόμενη εβδομάδα 12:09 μμ", "in 1 week 12:09 pm"),
        # et
        param('et', "eelmine nädal", "1 week ago"),
        param('et', "1 a pärast", "in 1 year"),
        param('et', "4 tunni eest", "4 hour ago"),
        # eu
        param('eu', "aurreko hilabetea", "1 month ago"),
github scrapinghub / dateparser / tests / test_languages.py View on Github external
        param('ar', "ساعتين", strip_timezone=False),
        param('tr', "3 hafta", strip_timezone=False),
        param('th', "17 เดือนมิถุนายน", strip_timezone=False),
        param('pl', "przedwczoraj", strip_timezone=False),
        param('fa', "ژانویه 8, 2015، ساعت 15:46", strip_timezone=False),
        param('vi', "2 tuần 3 ngày", strip_timezone=False),
        param('tl', "Hulyo 3, 2015 7:00 pm", strip_timezone=False),
        param('be', "3 верасня 2015 г. у 11:10", strip_timezone=False),
        param('id', "01 Agustus 2015 18:23", strip_timezone=False),
        param('he', "6 לדצמבר 1973", strip_timezone=False),
        param('bn', "3 সপ্তাহ", strip_timezone=False),
    ])
    def test_applicable_languages(self, shortname, datetime_string, strip_timezone):
        self.given_settings()
        self.given_bundled_language(shortname)
        self.given_string(datetime_string)
        self.when_datetime_string_checked_if_applicable(strip_timezone)
github scrapinghub / dateparser / tests / test_languages.py View on Github external
        param('fo', "mánadagur 30 januar 1976", "monday 30 january 1976"),
        param('fo', "2 apríl 1890 fríggjadagur", "2 april 1890 friday"),

        # fur
        param('fur', "12 avost 1990 domenie", "12 august 1990 sunday"),
        param('fur', "miercus 5 fev 1990 10:10 p", "wednesday 5 february 1990 10:10 pm"),

        # fy
        param('fy', "febrewaris 2 1987 freed", "february 2 1987 friday"),
        param('fy', "to 20 maaie 2010", "thursday 20 may 2010"),

        # ga
        param('ga', "1 bealtaine 2019 dé céadaoin", "1 may 2019 wednesday"),
        param('ga', "deireadh fómhair 12 aoine 10:09 pm", "october 12 friday 10:09 pm"),

        # gd
        param('gd', "2 am faoilleach 1890 diardaoin 02:13 m", "2 january 1890 thursday 02:13 am"),
github scrapinghub / dateparser / tests / test_freshness_date_parser.py View on Github external
        param('in 1 day', in_future={'days': 1}, period='day'),
        param('in a week', in_future={'weeks': 1}, period='week'),
        param('in 2 hours', in_future={'hours': 2}, period='day'),
        param('in about 23 hours', in_future={'hours': 23}, period='day'),
        param('in 1 year 2 months', in_future={'years': 1, 'months': 2}, period='month'),
        param('in 1 year, 09 months,01 weeks',
              in_future={'years': 1, 'months': 9, 'weeks': 1}, period='week'),
        param('in 1 year 11 months', in_future={'years': 1, 'months': 11}, period='month'),
        param('in 1 year 12 months', in_future={'years': 1, 'months': 12}, period='month'),
        param('in 15 hr', in_future={'hours': 15}, period='day'),
        param('in 15 hrs', in_future={'hours': 15}, period='day'),
        param('in 2 min', in_future={'minutes': 2}, period='day'),
        param('in 2 mins', in_future={'minutes': 2}, period='day'),
        param('in 3 sec', in_future={'seconds': 3}, period='day'),
        param('in 1000 years', in_future={'years': 1000}, period='year'),
        param('in 5000 months', in_future={'years': 416, 'months': 8}, period='month'),
        param('in {} months'.format(2013 * 12 + 8),