checkpoint
This commit is contained in:
@@ -29,12 +29,16 @@ class Deferred(Node):
|
||||
returns:
|
||||
mixed
|
||||
"""
|
||||
args = [p.parse(scope)
|
||||
if hasattr(p, 'parse')
|
||||
else p
|
||||
for p in self.args]
|
||||
if hasattr(self.mixin, 'call'):
|
||||
return self.mixin.call(scope, self.args)
|
||||
return self.mixin.call(scope, args)
|
||||
mixins = scope.mixins(self.mixin.raw())
|
||||
if not mixins: return mixins
|
||||
for mixin in mixins:
|
||||
res = mixin.call(scope, self.args)
|
||||
res = mixin.call(scope, args)
|
||||
if res:
|
||||
return res
|
||||
return False
|
||||
|
||||
@@ -77,7 +77,7 @@ class Expression(Node):
|
||||
returns:
|
||||
str
|
||||
"""
|
||||
if not val: return val
|
||||
if not val: return str(val)
|
||||
if ua or ub:
|
||||
if ua and ub:
|
||||
if ua == ub:
|
||||
@@ -88,7 +88,7 @@ class Expression(Node):
|
||||
return str(val) + ua
|
||||
elif ub:
|
||||
return str(val) + ub
|
||||
return val
|
||||
return str(val)
|
||||
|
||||
def operate(self, vala, valb, oper):
|
||||
"""Perform operation
|
||||
|
||||
@@ -33,7 +33,7 @@ class String(Node):
|
||||
returns:
|
||||
str
|
||||
"""
|
||||
var = '@' + var
|
||||
var = ''.join(utility.flatten(self.scope.swap(var)))
|
||||
var = self.scope.swap('@' + var)
|
||||
var = ''.join(utility.flatten(var))
|
||||
return var.strip("\"'")
|
||||
|
||||
@@ -6,14 +6,14 @@ from lesscpy.plib.expression import Expression
|
||||
class TestExpression(unittest.TestCase):
|
||||
def test_basic(self):
|
||||
for test in [
|
||||
['0', '+', '0', 0],
|
||||
['2', '+', '2', 4],
|
||||
['2.0', '+', '2', 4.0],
|
||||
['2', '+', '2.0', 4.0],
|
||||
['2.0', '+', '2.0', 4.0],
|
||||
[('2.0',), '+', '2.0', 4.0],
|
||||
[('2.0',), '+', ('2.0',), 4.0],
|
||||
['0px', '+', '0', 0],
|
||||
['0', '+', '0', '0'],
|
||||
['2', '+', '2', '4'],
|
||||
['2.0', '+', '2', '4.0'],
|
||||
['2', '+', '2.0', '4.0'],
|
||||
['2.0', '+', '2.0', '4.0'],
|
||||
[('2.0',), '+', '2.0', '4.0'],
|
||||
[('2.0',), '+', ('2.0',), '4.0'],
|
||||
['0px', '+', '0', '0'],
|
||||
['2px', '+', '2', '4px'],
|
||||
['2.0px', '+', '2', '4.0px'],
|
||||
[('2px', ' '), '+', '2.0', '4.0px'],
|
||||
@@ -24,17 +24,17 @@ class TestExpression(unittest.TestCase):
|
||||
|
||||
def test_neg(self):
|
||||
for test in [
|
||||
['-0', '+', '0', 0],
|
||||
['-2', '+', '-2', -4],
|
||||
['-2.0', '+', '-2', -4.0],
|
||||
['-2', '+', '-2.0', -4.0],
|
||||
['-2.0', '+', '-2.0', -4.0],
|
||||
['-0', '-', '0', 0],
|
||||
['-2', '-', '-2', 0],
|
||||
['-2.0', '-', '2', -4.0],
|
||||
['-2', '-', '-2.0', 0],
|
||||
['2.0', '-', '-2.0', 4.0],
|
||||
['-0px', '+', '0', 0],
|
||||
['-0', '+', '0', '0'],
|
||||
['-2', '+', '-2', '-4'],
|
||||
['-2.0', '+', '-2', '-4.0'],
|
||||
['-2', '+', '-2.0', '-4.0'],
|
||||
['-2.0', '+', '-2.0', '-4.0'],
|
||||
['-0', '-', '0', '0'],
|
||||
['-2', '-', '-2', '0'],
|
||||
['-2.0', '-', '2', '-4.0'],
|
||||
['-2', '-', '-2.0', '0.0'],
|
||||
['2.0', '-', '-2.0', '4.0'],
|
||||
['-0px', '+', '0', '0'],
|
||||
['-2px', '+', '-2', '-4px'],
|
||||
['-2.0', '+', '-2px', '-4.0px'],
|
||||
['-2em', '+', '-2.0', '-4.0em'],
|
||||
|
||||
Reference in New Issue
Block a user