Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.assertEqual(p.ud_match('aviatrix',p.pl_sb_user_defined),
'aviatrices')
p.defnoun('aviatrix','aviatrixes')
self.assertEqual(p.pl('aviatrix'),'aviatrixes')
self.assertEqual(p.ud_match('aviatrix',p.pl_sb_user_defined),
'aviatrixes')
p.defnoun('aviatrix',None)
self.assertEqual(p.pl('aviatrix'),'aviatrices')
self.assertEqual(p.ud_match('aviatrix',p.pl_sb_user_defined),
None)
p.defnoun('(cat)',r'$1s')
self.assertEqual(p.pl('cat'),'cats')
inflect.STDOUT_ON = False
self.assertRaises(inflect.BadUserDefinedPatternError, p.defnoun, '(??', None)
inflect.STDOUT_ON = True
p.defnoun(None,'') # check None doesn't crash it
#defverb
p.defverb('will','shall',
'will','will',
'will','will')
self.assertEqual(p.ud_match('will',p.pl_v_user_defined),
'will')
self.assertEqual(p.pl('will'),'will')
#TODO: will -> shall. Tests below fail
self.TODO(p.plequal('will','shall'),'s:p')
self.TODO(p.plverbequal('will','shall'),'s:p')
p.defnoun("aviatrix", "aviatrices")
self.assertEqual(p.plural("aviatrix"), "aviatrices")
self.assertEqual(p.ud_match("aviatrix", p.pl_sb_user_defined), "aviatrices")
p.defnoun("aviatrix", "aviatrixes")
self.assertEqual(p.plural("aviatrix"), "aviatrixes")
self.assertEqual(p.ud_match("aviatrix", p.pl_sb_user_defined), "aviatrixes")
p.defnoun("aviatrix", None)
self.assertEqual(p.plural("aviatrix"), "aviatrices")
self.assertEqual(p.ud_match("aviatrix", p.pl_sb_user_defined), None)
p.defnoun("(cat)", r"$1s")
self.assertEqual(p.plural("cat"), "cats")
inflect.STDOUT_ON = False
self.assertRaises(inflect.BadUserDefinedPatternError, p.defnoun, "(??", None)
inflect.STDOUT_ON = True
p.defnoun(None, "") # check None doesn't crash it
# defverb
p.defverb("will", "shall", "will", "will", "will", "will")
self.assertEqual(p.ud_match("will", p.pl_v_user_defined), "will")
self.assertEqual(p.plural("will"), "will")
# TODO: will -> shall. Tests below fail
self.TODO(p.compare("will", "shall"), "s:p")
self.TODO(p.compare_verbs("will", "shall"), "s:p")
# defadj
p.defadj("hir", "their")
self.assertEqual(p.plural("hir"), "their")
self.assertEqual(p.ud_match("hir", p.pl_adj_user_defined), "their")
self.assertEqual(p.ud_match('aviatrix', p.pl_sb_user_defined),
'aviatrices')
p.defnoun('aviatrix', 'aviatrixes')
self.assertEqual(p.plural('aviatrix'), 'aviatrixes')
self.assertEqual(p.ud_match('aviatrix', p.pl_sb_user_defined),
'aviatrixes')
p.defnoun('aviatrix', None)
self.assertEqual(p.plural('aviatrix'), 'aviatrices')
self.assertEqual(p.ud_match('aviatrix', p.pl_sb_user_defined),
None)
p.defnoun('(cat)', r'$1s')
self.assertEqual(p.plural('cat'), 'cats')
inflect.STDOUT_ON = False
self.assertRaises(inflect.BadUserDefinedPatternError, p.defnoun, '(??', None)
inflect.STDOUT_ON = True
p.defnoun(None, '') # check None doesn't crash it
# defverb
p.defverb('will', 'shall',
'will', 'will',
'will', 'will')
self.assertEqual(p.ud_match('will', p.pl_v_user_defined),
'will')
self.assertEqual(p.plural('will'), 'will')
# TODO: will -> shall. Tests below fail
self.TODO(p.compare('will', 'shall'), 's:p')
self.TODO(p.compare_verbs('will', 'shall'), 's:p')
# defadj
def checkpat(self, pattern):
"""
check for errors in a regex pattern
"""
if pattern is None:
return
try:
re.match(pattern, "")
except re.error:
print3("\nBad user-defined singular pattern:\n\t%s\n" % pattern)
raise BadUserDefinedPatternError