remove trailing whitespace everywhere
--HG-- branch : trunk
This commit is contained in:
@@ -126,13 +126,13 @@ def test_totext():
|
||||
py.builtin._totext("hello", "UTF-8")
|
||||
|
||||
def test_reraise():
|
||||
from py.builtin import _reraise
|
||||
from py.builtin import _reraise
|
||||
try:
|
||||
raise Exception()
|
||||
except Exception:
|
||||
cls, val, tb = sys.exc_info()
|
||||
excinfo = py.test.raises(Exception, "_reraise(cls, val, tb)")
|
||||
|
||||
|
||||
def test_exec():
|
||||
l = []
|
||||
py.builtin.exec_("l.append(1)")
|
||||
|
||||
@@ -9,10 +9,10 @@ def test_error_classes():
|
||||
assert issubclass(x, py.error.Error)
|
||||
assert issubclass(x, EnvironmentError)
|
||||
|
||||
def test_unknown_error():
|
||||
def test_unknown_error():
|
||||
num = 3999
|
||||
cls = py.error._geterrnoclass(num)
|
||||
assert cls.__name__ == 'UnknownErrno%d' % (num,)
|
||||
assert cls.__name__ == 'UnknownErrno%d' % (num,)
|
||||
assert issubclass(cls, py.error.Error)
|
||||
assert issubclass(cls, EnvironmentError)
|
||||
cls2 = py.error._geterrnoclass(num)
|
||||
@@ -23,7 +23,7 @@ def test_error_conversion_ENOTDIR(testdir):
|
||||
excinfo = py.test.raises(py.error.Error, py.error.checked_call, p.listdir)
|
||||
assert isinstance(excinfo.value, EnvironmentError)
|
||||
assert isinstance(excinfo.value, py.error.Error)
|
||||
assert "ENOTDIR" in repr(excinfo.value)
|
||||
assert "ENOTDIR" in repr(excinfo.value)
|
||||
|
||||
|
||||
def test_checked_call_supports_kwargs(tmpdir):
|
||||
|
||||
@@ -26,7 +26,7 @@ def test_invoke_compile(recwarn, monkeypatch):
|
||||
co = compile("def f(): return 1\n", '', 'exec')
|
||||
d = {}
|
||||
py.builtin.exec_(co, d)
|
||||
assert py.code.Source(d['f'])
|
||||
assert py.code.Source(d['f'])
|
||||
finally:
|
||||
py.magic.revoke(compile=True)
|
||||
recwarn.pop(DeprecationWarning)
|
||||
@@ -72,7 +72,7 @@ def test_AssertionError(testdir):
|
||||
recwarn.pop(DeprecationWarning)
|
||||
assert err is py.code._AssertionError
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
result = testdir.runpytest()
|
||||
assert "1 passed" in result.stdout.str()
|
||||
|
||||
def test_autopath_deprecation(testdir):
|
||||
@@ -83,13 +83,13 @@ def test_autopath_deprecation(testdir):
|
||||
recwarn.pop(DeprecationWarning)
|
||||
assert py.path.local(__file__).dirpath() == p.dirpath()
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
result = testdir.runpytest()
|
||||
assert "1 passed" in result.stdout.str()
|
||||
|
||||
class Testautopath:
|
||||
getauto = "from py.magic import autopath ; autopath = autopath()"
|
||||
def setup_class(cls):
|
||||
cls.root = py.test.ensuretemp(cls.__name__)
|
||||
def setup_class(cls):
|
||||
cls.root = py.test.ensuretemp(cls.__name__)
|
||||
cls.initdir = cls.root.ensure('pkgdir', dir=1)
|
||||
cls.initdir.ensure('__init__.py')
|
||||
cls.initdir2 = cls.initdir.ensure('initdir2', dir=1)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import py
|
||||
from py._xmlgen import unicode, html
|
||||
|
||||
class ns(py.xml.Namespace):
|
||||
pass
|
||||
class ns(py.xml.Namespace):
|
||||
pass
|
||||
|
||||
def test_escape():
|
||||
uvalue = py.builtin._totext('\xc4\x85\xc4\x87\n', 'utf-8')
|
||||
@@ -16,46 +16,46 @@ def test_escape():
|
||||
return x.encode('utf-8')
|
||||
return x
|
||||
y = py.xml.escape(uvalue)
|
||||
assert y == uvalue
|
||||
assert y == uvalue
|
||||
x = py.xml.escape(A())
|
||||
assert x == uvalue
|
||||
assert x == uvalue
|
||||
if py.std.sys.version_info[0] < 3:
|
||||
assert isinstance(x, unicode)
|
||||
assert isinstance(y, unicode)
|
||||
|
||||
|
||||
def test_tag_with_text():
|
||||
x = ns.hello("world")
|
||||
u = unicode(x)
|
||||
|
||||
def test_tag_with_text():
|
||||
x = ns.hello("world")
|
||||
u = unicode(x)
|
||||
assert u == "<hello>world</hello>"
|
||||
|
||||
def test_class_identity():
|
||||
assert ns.hello is ns.hello
|
||||
|
||||
def test_tag_with_text_and_attributes():
|
||||
x = ns.some(name="hello", value="world")
|
||||
def test_class_identity():
|
||||
assert ns.hello is ns.hello
|
||||
|
||||
def test_tag_with_text_and_attributes():
|
||||
x = ns.some(name="hello", value="world")
|
||||
assert x.attr.name == 'hello'
|
||||
assert x.attr.value == 'world'
|
||||
u = unicode(x)
|
||||
assert u == '<some name="hello" value="world"/>'
|
||||
u = unicode(x)
|
||||
assert u == '<some name="hello" value="world"/>'
|
||||
|
||||
def test_tag_with_subclassed_attr_simple():
|
||||
class my(ns.hello):
|
||||
class Attr(ns.hello.Attr):
|
||||
hello="world"
|
||||
x = my()
|
||||
assert x.attr.hello == 'world'
|
||||
assert unicode(x) == '<my hello="world"/>'
|
||||
def test_tag_with_subclassed_attr_simple():
|
||||
class my(ns.hello):
|
||||
class Attr(ns.hello.Attr):
|
||||
hello="world"
|
||||
x = my()
|
||||
assert x.attr.hello == 'world'
|
||||
assert unicode(x) == '<my hello="world"/>'
|
||||
|
||||
def test_tag_nested():
|
||||
def test_tag_nested():
|
||||
x = ns.hello(ns.world())
|
||||
unicode(x) # triggers parentifying
|
||||
assert x[0].parent is x
|
||||
u = unicode(x)
|
||||
assert x[0].parent is x
|
||||
u = unicode(x)
|
||||
assert u == '<hello><world/></hello>'
|
||||
|
||||
def test_tag_xmlname():
|
||||
class my(ns.hello):
|
||||
def test_tag_xmlname():
|
||||
class my(ns.hello):
|
||||
xmlname = 'world'
|
||||
u = unicode(my())
|
||||
assert u == '<world/>'
|
||||
@@ -77,41 +77,41 @@ def test_raw():
|
||||
assert u == "<some><p>literal</p></some>"
|
||||
|
||||
|
||||
def test_html_name_stickyness():
|
||||
class my(html.p):
|
||||
pass
|
||||
x = my("hello")
|
||||
assert unicode(x) == '<p>hello</p>'
|
||||
def test_html_name_stickyness():
|
||||
class my(html.p):
|
||||
pass
|
||||
x = my("hello")
|
||||
assert unicode(x) == '<p>hello</p>'
|
||||
|
||||
def test_stylenames():
|
||||
class my:
|
||||
class body(html.body):
|
||||
def test_stylenames():
|
||||
class my:
|
||||
class body(html.body):
|
||||
style = html.Style(font_size = "12pt")
|
||||
u = unicode(my.body())
|
||||
assert u == '<body style="font-size: 12pt"></body>'
|
||||
assert u == '<body style="font-size: 12pt"></body>'
|
||||
|
||||
def test_class_None():
|
||||
def test_class_None():
|
||||
t = html.body(class_=None)
|
||||
u = unicode(t)
|
||||
u = unicode(t)
|
||||
assert u == '<body></body>'
|
||||
|
||||
def test_alternating_style():
|
||||
def test_alternating_style():
|
||||
alternating = (
|
||||
html.Style(background="white"),
|
||||
html.Style(background="white"),
|
||||
html.Style(background="grey"),
|
||||
)
|
||||
class my(html):
|
||||
class li(html.li):
|
||||
def style(self):
|
||||
i = self.parent.index(self)
|
||||
class my(html):
|
||||
class li(html.li):
|
||||
def style(self):
|
||||
i = self.parent.index(self)
|
||||
return alternating[i%2]
|
||||
style = property(style)
|
||||
|
||||
style = property(style)
|
||||
|
||||
x = my.ul(
|
||||
my.li("hello"),
|
||||
my.li("world"),
|
||||
my.li("hello"),
|
||||
my.li("world"),
|
||||
my.li("42"))
|
||||
u = unicode(x)
|
||||
u = unicode(x)
|
||||
assert u == ('<ul><li style="background: white">hello</li>'
|
||||
'<li style="background: grey">world</li>'
|
||||
'<li style="background: white">42</li>'
|
||||
@@ -120,7 +120,7 @@ def test_alternating_style():
|
||||
def test_singleton():
|
||||
h = html.head(html.link(href="foo"))
|
||||
assert unicode(h) == '<head><link href="foo"/></head>'
|
||||
|
||||
|
||||
h = html.head(html.script(src="foo"))
|
||||
assert unicode(h) == '<head><script src="foo"></script></head>'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user