How to use the inflect.UnknownClassicalModeError function in inflect

To help you get started, we’ve selected a few inflect 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 jazzband / inflect / tests / test_pwd.py View on Github external
p.classical(all=True)
        self.assertEqual(p.classical_dict, inflect.all_classical)

        p.classical(all=False)
        p.classical(names=True, zero=True)
        mydict = inflect.def_classical.copy()
        mydict.update(dict(names=True, zero=True))
        self.assertEqual(p.classical_dict, mydict)

        p.classical(all=False)
        p.classical(names=True, zero=False)
        mydict = inflect.def_classical.copy()
        mydict.update(dict(names=True, zero=False))
        self.assertEqual(p.classical_dict, mydict)

        self.assertRaises(UnknownClassicalModeError, p.classical, bogus=True)
github GeneralizedLearningUtilities / SuperGLU / python_module / SuperGLU / Services / TextProcessing / Tests / Inflect / test_pwd.py View on Github external
p.classical(all=True)
        self.assertEqual(p.classical_dict, inflect.all_classical)

        p.classical(all=False)
        p.classical(names=True, zero=True)
        mydict = inflect.def_classical.copy()
        mydict.update(dict(names=True, zero=True))
        self.assertEqual(p.classical_dict, mydict)

        p.classical(all=False)
        p.classical(names=True, zero=False)
        mydict = inflect.def_classical.copy()
        mydict.update(dict(names=True, zero=False))
        self.assertEqual(p.classical_dict, mydict)

        self.assertRaises(UnknownClassicalModeError, p.classical, bogus=True)
github jazzband / inflect / tests.py View on Github external
mydict.update(dict(names=1,zero=1))
        self.assertEqual(p.classical_dict, mydict)

        p.classical(0)
        p.classical('names', zero=1)
        mydict = inflect.def_classical.copy()
        mydict.update(dict(names=1,zero=1))
        self.assertEqual(p.classical_dict, mydict)

        p.classical(0)
        p.classical('names', zero=0)
        mydict = inflect.def_classical.copy()
        mydict.update(dict(names=1,zero=0))
        self.assertEqual(p.classical_dict, mydict)

        self.assertRaises(UnknownClassicalModeError, p.classical, 'bogus', reallybogus=1)
github jazzband / inflect / inflect.py View on Github external
"""
        classical_mode = list(def_classical.keys())
        if not kwargs:
            self.classical_dict = all_classical.copy()
            return
        if "all" in kwargs:
            if kwargs["all"]:
                self.classical_dict = all_classical.copy()
            else:
                self.classical_dict = no_classical.copy()

        for k, v in list(kwargs.items()):
            if k in classical_mode:
                self.classical_dict[k] = v
            else:
                raise UnknownClassicalModeError