~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.py

  • Committer: Martin Pool
  • Date: 2008-04-24 07:22:53 UTC
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080424072253-opmjij7xfy38w27f
Remove every assert statement from bzrlib!

Depending on the context they are:

 * turned into an explicit if/raise of either AssertionError 
   or something more specific -- particularly where they protect
   programming interfaces, complex invariants, or data file integrity
 * removed, if they're redundant with a later check, not protecting
   a meaningful invariant
 * turned into a selftest method on tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
        """
163
163
        # The state should already be write locked, since we just had to do
164
164
        # some operation to get here.
165
 
        assert state._lock_token is not None
 
165
        self.assertTrue(state._lock_token is not None)
166
166
        try:
167
167
            self.assertEqual(expected_result[0],  state.get_parent_ids())
168
168
            # there should be no ghosts in this tree.
2054
2054
        # the end it would still be fairly arbitrary, and we don't want the
2055
2055
        # extra overhead if we can avoid it. So sort everything to make sure
2056
2056
        # equality is true
2057
 
        assert len(map_keys) == len(paths)
 
2057
        self.assertEqual(len(map_keys), len(paths))
2058
2058
        expected = {}
2059
2059
        for path, keys in zip(paths, map_keys):
2060
2060
            if keys is None:
2079
2079
        :param paths: A list of directories
2080
2080
        """
2081
2081
        result = state._bisect_dirblocks(paths)
2082
 
        assert len(map_keys) == len(paths)
2083
 
 
 
2082
        self.assertEqual(len(map_keys), len(paths))
2084
2083
        expected = {}
2085
2084
        for path, keys in zip(paths, map_keys):
2086
2085
            if keys is None: