#!/usr/bin/env python # -*- coding: iso-8859-1 -*- ## Copyright 2005/2006 by LivingLogic AG, Bayreuth/Germany. ## Copyright 2005/2006 by Walter Dörwald ## ## All Rights Reserved ## ## See __init__.py for the license import py.test from ll import xpit def test_plain(): assert xpit.convert("foo") == "foo" assert xpit.convert("foobar") == "foo", globals=dict(a=17, b=23)) == "40" def test_if(): assert xpit.convert("gurkhurz", globals=dict(a=17, b=23)) == "gurk" assert xpit.convert("0?>foobarbaz", globals=dict(a=17)) == "foo" def test_nestedif(): code = """ a==16 a==17 b==17 b!=17 a != (16, 17) """ assert "".join(xpit.convert(code, globals=dict(a=17, b=23)).split()) == "a==17b!=17"