~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/textui.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:
25
25
        kind_ch = '/'
26
26
    elif kind == 'symlink':
27
27
        kind_ch = '->'
 
28
    elif kind == 'file':
 
29
        kind_ch = ''
28
30
    else:
29
 
        assert kind == 'file', ("can't handle file of type %r" % kind)
30
 
        kind_ch = ''
 
31
        raise ValueError(kind)
31
32
 
32
 
    assert len(state) == 1
 
33
    if len(state) != 1:
 
34
        raise ValueError(state)
33
35
        
34
36
    if to_file is None:
35
37
        to_file = sys.stdout