After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 740337 - Improve usage of assertAlmostEqual()
Improve usage of assertAlmostEqual()
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2014-11-18 17:25 UTC by Arfrever Frehtes Taifersar Arahesis
Modified: 2016-06-07 08:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (1.58 KB, patch)
2014-11-18 17:26 UTC, Arfrever Frehtes Taifersar Arahesis
none Details | Review
tests: Use places kwarg for assertAlmostEqual (2.39 KB, patch)
2016-06-06 18:47 UTC, Christoph Reiter (lazka)
committed Details | Review

Description Arfrever Frehtes Taifersar Arahesis 2014-11-18 17:25:13 UTC
Test suite of pygobject sometimes passes "places" argument of assertAlmostEqual() as positional argument and sometimes as keyword argument. I suggest to always pass it as keyword argument.

$ grep -r assertAlmostEqual *
ChangeLog:    assertAlmostEquals → assertAlmostEqual
tests/test_gobject.py:        self.assertAlmostEqual(value.get_value(), 1e50)
tests/test_properties.py:        self.assertAlmostEqual(self.get_prop(obj, 'some-float'), 42.42, 4)
tests/test_properties.py:        self.assertAlmostEqual(self.get_prop(obj, 'some-float'), 42.0, 4)
tests/test_properties.py:        self.assertAlmostEqual(self.get_prop(obj, 'some-float'), 42.0, 4)
tests/test_properties.py:        self.assertAlmostEqual(self.get_prop(obj, 'some-double'), 42.42)
tests/test_properties.py:        self.assertAlmostEqual(self.get_prop(obj, 'some-double'), 42.0)
tests/test_properties.py:        self.assertAlmostEqual(self.get_prop(obj, 'some-double'), 42.0)
tests/test_everything.py:        self.assertAlmostEqual(two, 5.0)
tests/test_everything.py:        self.assertAlmostEqual(three, 7.5)
tests/test_signal.py:        self.assertAlmostEqual(rv, 1.234, 4)
tests/test_signal.py:        self.assertAlmostEqual(rv, 1.234, 4)
tests/test_gi.py:        self.assertAlmostEqual(self.MAX, GIMarshallingTests.float_return())
tests/test_gi.py:        self.assertAlmostEqual(self.MAX, GIMarshallingTests.float_out())
tests/test_gi.py:        self.assertAlmostEqual(self.MIN, GIMarshallingTests.float_inout(Number(self.MAX)))
tests/test_gi.py:        self.assertAlmostEqual(self.MAX, GIMarshallingTests.double_return())
tests/test_gi.py:        self.assertAlmostEqual(self.MAX, GIMarshallingTests.double_out())
tests/test_gi.py:        self.assertAlmostEqual(self.MIN, GIMarshallingTests.double_inout(Number(self.MAX)))
tests/test_gi.py:        self.assertAlmostEqual(GIMarshallingTests.callback_one_out_parameter(cb), 5.5)
tests/test_gi.py:        self.assertAlmostEqual(res[0], 5.5)
tests/test_gi.py:        self.assertAlmostEqual(res[1], 42.0)
tests/test_gi.py:        self.assertAlmostEqual(res[1], 42.0)
tests/test_gi.py:        self.assertAlmostEqual(object_.vfunc_one_out_parameter(), 42.42, places=5)
tests/test_gi.py:        self.assertAlmostEqual(a, 42.42, places=5)
tests/test_gi.py:        self.assertAlmostEqual(b, 3.14, places=5)
Comment 1 Arfrever Frehtes Taifersar Arahesis 2014-11-18 17:26:09 UTC
Created attachment 290936 [details] [review]
Patch
Comment 2 Simon Feltman 2014-11-19 03:36:10 UTC
Review of attachment 290936 [details] [review]:

I agree this is nicer, can you add a commit message? see:
https://wiki.gnome.org/GnomeLove/SubmittingPatches
https://wiki.gnome.org/Git/CommitMessages
Comment 3 Arfrever Frehtes Taifersar Arahesis 2014-11-19 06:47:57 UTC
Commit message: "Always pass 'places' argument of unittest.TestCase.assertAlmostEqual as keyword argument."
Comment 4 Christoph Reiter (lazka) 2016-06-06 18:47:22 UTC
Created attachment 329227 [details] [review]
tests: Use places kwarg for assertAlmostEqual