def convert(self, converter):
		e = xsc.Frag(
			detox.while_(self.attrs.loop),
				self.content,
			detox.end("while")
		)
		return e.convert(converter)
def test_text():
	with xsc.build():
		with xsc.Frag() as e:
			+detox.def_("gurk()")
			+xsc.Text("foo")
			+detox.end("def")
	assert makeoutput(e, "gurk") == "foo"
	def convert(self, converter):
		e = xsc.Frag(
			detox.def_(self.attrs.func),
				self.content,
			detox.end("def")
		)
		return e.convert(converter)
	def convert(self, converter):
		e = xsc.Frag(
			detox.for_(self.attrs.loop),
				self.content,
			detox.end("for")
		)
		return e.convert(converter)
def test_text():
	with xsc.build():
		with xsc.Frag() as e:
			+detox.def_("gurk()")
			+xsc.Text("foo")
			+detox.end("def")
	assert makeoutput(e, "gurk") == "foo"
	def convert(self, converter):
		e = xsc.Frag(
			detox.while_(self.attrs.loop),
				self.content,
			detox.end("while")
		)
		return e.convert(converter)
	def convert(self, converter):
		e = xsc.Frag(
			detox.for_(self.attrs.loop),
				self.content,
			detox.end("for")
		)
		return e.convert(converter)
	def convert(self, converter):
		e = xsc.Frag(
			detox.def_(self.attrs.func),
				self.content,
			detox.end("def")
		)
		return e.convert(converter)
def test_scopecheck():
	with xsc.build():
		with xsc.Frag() as e:
			+detox.def_("gurk()")
			+xsc.Text("hurz")
			+detox.end()

	assert makeoutput(e, "gurk") == "hurz"

	with xsc.build():
		with xsc.Frag() as e:
			+detox.def_("gurk()")
			+xsc.Text("hurz")
			+detox.end("for")

	with pytest.raises(SyntaxError):
		makeoutput(e, "gurk")
def test_scopecheck():
	with xsc.build():
		with xsc.Frag() as e:
			+detox.def_("gurk()")
			+xsc.Text("hurz")
			+detox.end()

	assert makeoutput(e, "gurk") == "hurz"

	with xsc.build():
		with xsc.Frag() as e:
			+detox.def_("gurk()")
			+xsc.Text("hurz")
			+detox.end("for")

	with pytest.raises(SyntaxError):
		makeoutput(e, "gurk")
def test_if():
	with xsc.build():
		with xsc.Frag() as e:
			with defblock(func="gurk(arg)"):
				+detox.if_("arg>2")
				+detox.expr("str(2*arg)")
				+detox.else_()
				+detox.expr("str(3*arg)")
				+detox.end("if")

	assert makeoutput(e, "gurk", 0) == "0"
	assert makeoutput(e, "gurk", 1) == "3"
	assert makeoutput(e, "gurk", 2) == "6"
	assert makeoutput(e, "gurk", 3) == "6"
	assert makeoutput(e, "gurk", 4) == "8"
def test_if():
	with xsc.build():
		with xsc.Frag() as e:
			with defblock(func="gurk(arg)"):
				+detox.if_("arg>2")
				+detox.expr("str(2*arg)")
				+detox.else_()
				+detox.expr("str(3*arg)")
				+detox.end("if")

	assert makeoutput(e, "gurk", 0) == "0"
	assert makeoutput(e, "gurk", 1) == "3"
	assert makeoutput(e, "gurk", 2) == "6"
	assert makeoutput(e, "gurk", 3) == "6"
	assert makeoutput(e, "gurk", 4) == "8"