[Merge] performance increases for 'bzr status'

John Arbash Meinel john at arbash-meinel.com
Tue May 30 14:28:59 BST 2006


Andrew Bennetts wrote:
> On Tue, May 30, 2006 at 12:33:37AM -0500, John A Meinel wrote:
> [...]
>> But 'modified' and 'unchanged' shouldn't need to be sorted.
>> Is there anyway to just assert that a list is sorted for testing purposes?
> 
> The simplest way is "self.assertEqual(sorted(some_list), some_list)" I think.
> 
> -Andrew.
> 
> 

Actually, I though 'sorted()' sorts the list and just returns it. ie the
definition is:

def sorted(lst):
  lst.sort()
  return lst

Which means that the above would always return true.

I was hoping to have something inexpensive that wouldn't require copying
the list, but the best I could think of was:

assert sorted(some_list[:]) == some_list, "lists are not sorted".

(This was runtime code, not test code)

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060530/42c66d38/attachment.pgp 


More information about the bazaar mailing list