Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated aliases in unittest were removed in Python 3.11 #162

Closed
tirkarthi opened this issue Oct 4, 2021 · 1 comment · Fixed by #163
Closed

Deprecated aliases in unittest were removed in Python 3.11 #162

tirkarthi opened this issue Oct 4, 2021 · 1 comment · Fixed by #163

Comments

@tirkarthi
Copy link
Contributor

Ref : python/cpython#28268 . Below instances need to be changed to use assert* equivalents. I will raise a PR for this.

rg -t py 'assertEquals|assertNotEquals|assertAlmostEquals|assertNotAlmostEquals|assertRegexpMatches|assertNotRegexpMatches|assertRaisesRegexp|failUnlessEqual|failIfEqual|failUnlessAlmostEqual|failUnless|failUnlessRaises|failIf'                             
testfixtures/tests/test_date.py
69:        self.failIf(dt.__class__ is d)
217:            self.failUnless(isinstance(inst, date), inst)
218:            self.failUnless(inst.__class__ is date, inst)
219:            self.failUnless(isinstance(inst, d), inst)
220:            self.failIf(inst.__class__ is d, inst)
245:            self.failIf(isinstance(inst, date), inst)
246:            self.failIf(inst.__class__ is date, inst)
247:            self.failUnless(isinstance(inst, d), inst)
248:            self.failUnless(inst.__class__ is d, inst)

testfixtures/tests/test_log_capture.py
101:        self.failUnless(isinstance(l, LogCapture))

testfixtures/tests/test_tempdirectory.py
130:        self.failIf(os.path.exists(d))

testfixtures/tests/test_comparison.py
684:            self.failUnless(isinstance(e, AttributeError))

testfixtures/tests/test_replace.py
47:        self.failIf(OriginalX is ReplacementX)
48:        self.failUnless(isinstance(sample1.X(), OriginalX))
52:            self.failIf(OriginalX is ReplacementX)
53:            self.failUnless(isinstance(sample1.X(), ReplacementX))
55:        self.failIf(OriginalX is ReplacementX)
56:        self.failUnless(isinstance(sample1.X(), OriginalX))
60:        self.failIf(OriginalX is ReplacementX)
61:        self.failUnless(isinstance(sample1.X(), OriginalX))
72:            self.failUnless(isinstance(sample1.X().y(), sample1.X))
173:            self.failUnless(r is o)
174:            self.failUnless(sample1.z is o)
195:            self.failUnless(r is o)
196:            self.failUnless(sample1.bad is o)
209:            self.failUnless(obj is replacement)
210:            self.failUnless(someDict['key'] is replacement)
214:        self.failUnless(someDict['key'] is original)
222:            self.failIf(hasattr(sample1, 'someDict'))
245:            self.failIf(hasattr(sample1, 'foo'))
259:        self.failIf(hasattr(sample1, 'foo'))
283:            self.failIf('key' in someDict)
295:            self.failIf('badkey' in someDict)  # pragma: no cover
309:            self.failIf('badkey' in someDict)
338:            self.failUnless(obj is replacement)
339:            self.failUnless(someDict['key2'] is replacement)
367:            self.failUnless(obj is replacement)
374:        self.failUnless(original is someDict['complex_key'][1])

testfixtures/tests/test_datetime.py
139:        self.failIf(dt.__class__ is d)
149:            self.failUnless(d.__class__ is date)
162:            self.failUnless(d.__class__ is date_type)
331:            self.failUnless(isinstance(inst, datetime), inst)
332:            self.failUnless(inst.__class__ is datetime, inst)
333:            self.failUnless(isinstance(inst, d), inst)
334:            self.failIf(inst.__class__ is d, inst)
363:            self.failIf(isinstance(inst, datetime), inst)
364:            self.failIf(inst.__class__ is datetime, inst)
365:            self.failUnless(isinstance(inst, d), inst)
366:            self.failUnless(inst.__class__ is d, inst)

testfixtures/tests/test_tempdir.py
65:            self.failUnless(os.path.exists(d))
80:            self.failIf(os.path.exists(d))
96:        self.failUnless(isinstance(d, TempDirectory))

testfixtures/tests/test_generator.py
12:        self.failUnless(isinstance(g, GeneratorType))
18:        self.failUnless(isinstance(g, GeneratorType))

testfixtures/tests/test_stringcomparison.py
11:        self.failUnless('on 40220' == S('on \d+'))
14:        self.failIf('on xxx' == S('on \d+'))
17:        self.failIf('on 40220' != S('on \d+'))
20:        self.failUnless('on xxx' != S('on \d+'))
23:        self.failUnless((
30:        self.failIf(40220 == S('on \d+'))
51:            self.failIf(cmp(S('on \d+'), 'on 4040'))
54:            self.failUnless(cmp(S('on \d+'), 'on xx'))
@cjw296
Copy link
Member

cjw296 commented Oct 4, 2021

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants