Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)
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)
"""
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