~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-08-16 10:09:39 UTC
  • mfrom: (2713.1.1 assert-subset)
  • Revision ID: pqm@pqm.ubuntu.com-20070816100939-8cm630hgejoaur5a
BetterĀ assertSubsetĀ implementation

Show diffs side-by-side

added added

removed removed

Lines of Context:
863
863
 
864
864
    def assertSubset(self, sublist, superlist):
865
865
        """Assert that every entry in sublist is present in superlist."""
866
 
        missing = []
867
 
        for entry in sublist:
868
 
            if entry not in superlist:
869
 
                missing.append(entry)
 
866
        missing = set(sublist) - set(superlist)
870
867
        if len(missing) > 0:
871
868
            raise AssertionError("value(s) %r not present in container %r" % 
872
869
                                 (missing, superlist))