Esempio n. 1
0
def poktranslator_test(self, expected_sig_str, orig_sig_str, posoargs,
                       kwoargs):
    expected_sig = s(expected_sig_str)
    orig_sig = s(orig_sig_str)
    for exp, orig in defaults_variations(expected_sig, orig_sig):
        for exp, orig in stars_variations(exp, orig):
            func = modifiers._PokTranslator(func_from_sig(orig), posoargs,
                                            kwoargs)
            self.assertSigsEqual(exp, signature(func))
            test_func_sig_coherent(func)
            repr(func)  # must not cause an error
Esempio n. 2
0
def poktranslator_test(self, expected_sig_str, orig_sig_str,
                        posoargs, kwoargs):
    expected_sig = s(expected_sig_str)
    orig_sig = s(orig_sig_str)
    for exp, orig in defaults_variations(expected_sig, orig_sig):
        for exp, orig in stars_variations(exp, orig):
            func = modifiers._PokTranslator(
                func_from_sig(orig), posoargs, kwoargs)
            self.assertSigsEqual(exp, signature(func))
            test_func_sig_coherent(func)
            repr(func) # must not cause an error
Esempio n. 3
0
def test_roundtrip(self, sig_str, old_fmt=None):
    sig = support.s(sig_str)
    p_sig_str = str(sig)
    try:
        self.assertEqual('(' + sig_str + ')', p_sig_str)
    except AssertionError:
        if old_fmt is None: raise
        self.assertEqual('(' + old_fmt + ')', p_sig_str)

    pf_sig_str = str(_signatures.forged_signature(support.func_from_sig(sig)))
    try:
        self.assertEqual('(' + sig_str + ')', pf_sig_str)
    except AssertionError:
        if old_fmt is None: raise
        self.assertEqual('(' + old_fmt + ')', pf_sig_str)
Esempio n. 4
0
    def _test(self, sig_str, old_fmt=None):
        sig = support.s(sig_str)
        p_sig_str = str(sig)
        try:
            self.assertEqual('(' + sig_str + ')', p_sig_str)
        except AssertionError:
            if old_fmt is None: raise
            self.assertEqual('(' + old_fmt + ')', p_sig_str)

        pf_sig_str = str(
            _specifiers.forged_signature(support.func_from_sig(sig)))
        try:
            self.assertEqual('(' + sig_str + ')', pf_sig_str)
        except AssertionError:
            if old_fmt is None: raise
            self.assertEqual('(' + old_fmt + ')', pf_sig_str)
Esempio n. 5
0
    def _test(self, sig_str, old_fmt=None):
        sig = support.s(sig_str)
        p_sig_str = str(sig)
        try:
            self._assert_equal_ignoring_spaces('(' + sig_str + ')', p_sig_str)
        except AssertionError:
            if old_fmt is None: raise
            self._assert_equal_ignoring_spaces('(' + old_fmt + ')', p_sig_str)

        pf_sig_str = str(
            _specifiers.forged_signature(support.func_from_sig(sig)))
        try:
            self._assert_equal_ignoring_spaces('(' + sig_str + ')', pf_sig_str)
        except AssertionError:
            if old_fmt is None: raise
            self._assert_equal_ignoring_spaces('(' + old_fmt + ')', pf_sig_str)