/usr/share/pyshared/wimpiggy/test_error.py is in python-wimpiggy 0.0.7.36+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # This file is part of Parti.
# Copyright (C) 2008, 2009 Nathaniel Smith <njs@pobox.com>
# Parti is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.
#@PydevCodeAnalysisIgnore
from wimpiggy.test import *
from wimpiggy.error import trap, XError
# Need a way to generate X errors...
import wimpiggy.lowlevel
import gtk.gdk
class TestError(TestWithSession):
def cause_badwindow(self):
root = self.display.get_default_screen().get_root_window()
win = gtk.gdk.Window(root, width=10, height=10,
window_type=gtk.gdk.WINDOW_TOPLEVEL,
wclass=gtk.gdk.INPUT_OUTPUT,
event_mask=0)
win.destroy()
wimpiggy.lowlevel.XAddToSaveSet(win)
return 3
def test_call(self):
assert trap.call(lambda: 0) == 0
assert trap.call(lambda: 1) == 1
try:
trap.call(self.cause_badwindow)
except XError, e:
assert e.args == (wimpiggy.lowlevel.const["BadWindow"],)
def test_swallow(self):
assert trap.swallow(lambda: 0) is None
assert trap.swallow(lambda: 1) is None
assert trap.swallow(self.cause_badwindow) is None
def test_assert_out(self):
def foo():
assert_raises(AssertionError, trap.assert_out)
trap.call(foo)
|