subvertpy-users team mailing list archive
-
subvertpy-users team
-
Mailing list archive
-
Message #00017
[PATCH 1 of 3] Rather than raising an AssertionError, assert
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@xxxxxxxxx>
# Date 1284483682 -7200
# Node ID 25a25762a53f54431bfa7c723ff80cddb4a700c4
# Parent 8e94d184a78f19c3739a486ab0a9a0ba1300714e
Rather than raising an AssertionError, assert.
Asserting is appropriate here, as the check primarily functions as an
internal consistency check against clients of Subvertpy. Some end-user
software runs in -O mode, disabling assertions.
diff --git a/subvertpy/delta.py b/subvertpy/delta.py
--- a/subvertpy/delta.py
+++ b/subvertpy/delta.py
@@ -42,8 +42,7 @@ def apply_txdelta_window(sbuf, window):
(sview_offset, sview_len, tview_len, src_ops, ops, new_data) = window
sview = sbuf[sview_offset:sview_offset+sview_len]
tview = txdelta_apply_ops(src_ops, ops, new_data, sview)
- if len(tview) != tview_len:
- raise AssertionError("%d != %d" % (len(tview), tview_len))
+ assert len(tview) == tview_len, "%d != %d" % (len(tview), tview_len)
return tview
References