Changeset - 7817e1ef0ff0
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 10 years ago 2015-06-13 06:12:44
drewp@bigasterisk.com
remove 'currentSubLevel' autoapply
Ignore-this: a0351bb0759ee8d35ba1d4e609f93e4b
2 files changed with 2 insertions and 7 deletions:
0 comments (0 inline, 0 general)
light9/effecteval/effect.py
Show inline comments
 
@@ -41,13 +41,14 @@ class CodeLine(object):
 
        def repl(m):
 
            v = '_res%s' % self.uriCounter
 
            self.uriCounter += 1
 
            r = resources[v] = URIRef(m.group(1))
 
            for uriTypeMatches, wrapFuncName, addlArgs in [
 
                    (self._uriIsCurve(r), 'curve', ', t'),
 
                    (self._uriIsSub(r), 'currentSubLevel', ''),
 
                    # I'm pretty sure this shouldn't be auto-applied: it's reasonable to refer to a sub and not want its current value
 
                    #(self._uriIsSub(r), 'currentSubLevel', ''),
 
            ]:
 
                if uriTypeMatches:
 
                    if not alreadyInFunc(wrapFuncName + '(', m.string, m.start()):
 
                        return '%s(%s%s)' % (wrapFuncName, v, addlArgs)
 
            return v
 
        outExpr = re.sub(r'<(http\S*?)>', repl, expr)
light9/effecteval/test_effect.py
Show inline comments
 
@@ -52,18 +52,12 @@ class TestAsPython(unittest.TestCase):
 

	
 
    def test_curve_doesnt_double_wrap(self):
 
        ec = CodeLine(graph=None, code='x = curve(<http://example/curve1>, t+.01)')
 
        _, inExpr, expr, uris = ec._asPython()
 
        self.assertEqual('curve(_res0, t+.01)', expr)
 
        self.assertEqual({'_res0': URIRef('http://example/curve1')}, uris)
 

	
 
    def test_sub_uri_expands_to_sub_lookup_func(self):
 
        ec = CodeLine(graph=None, code='x = <http://example/sub1>')
 
        _, inExpr, expr, uris = ec._asPython()
 
        self.assertEqual('currentSubLevel(_res0)', expr)
 
        self.assertEqual({'_res0': URIRef('http://example/sub1')}, uris)
 
        
 
        
 
@mock.patch('light9.effecteval.effect.CodeLine._uriIsCurve', new=isCurve)
 
@mock.patch('light9.effecteval.effect.CodeLine._resourcesAsPython',
 
            new=lambda self, r: self.expr)
 
class TestPossibleVars(unittest.TestCase):
0 comments (0 inline, 0 general)