Message224128
I think that your test patch misses the confusing/possibly wrong case. That case is when two files have the same contents, but different mtimes. If you attempt a shallow comparison, you'll actually get a deep comparison (reading the whole files) and a result of True rather than the expected (though incorrect) False.
Try the test part of my patch (without the behavior change), and you'll see the failure of "test_shallow_false_negative". In your first assertion (that "filecmp.cmp(self.name, self.name_uppercase)" is False), you get the expected result, but for the wrong reason (you get it because the file contents differ, not because they have different mtimes).
Now, it might be that the "bad" case is actually working as we want it to (or at least, the behavior is established enough that we don't want to change it, for risk of breaking running code). If so, we should instead change the documentation (and especially the docstring) to explicit state that even if you request a shallow comparison, you might get a deep comparison instead. |
|
Date |
User |
Action |
Args |
2014-07-27 13:22:46 | Steven.Barker | set | recipients:
+ Steven.Barker, fdrake, georg.brandl, rhettinger, pvrijlandt, goatsofmendez, sandro.tosi, chris.jerdonek, Andrew.Kubera |
2014-07-27 13:22:46 | Steven.Barker | set | messageid: <1406467366.42.0.199671501835.issue1234674@psf.upfronthosting.co.za> |
2014-07-27 13:22:46 | Steven.Barker | link | issue1234674 messages |
2014-07-27 13:22:46 | Steven.Barker | create | |
|