Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Cisphyx committed Dec 20, 2024
1 parent 08e6f04 commit 749d042
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions synapse/tests/test_lib_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,11 @@ async def test_ast_condsetoper(self):
self.eq('newv', nodes[0].get('hehe'))
self.eq(tick, nodes[0].get('tick'))

q = '$foo=always [test:str=foo :tick*$foo?=2021]'
nodes = await core.nodes(q)
self.len(1, nodes)
self.ne(tick, nodes[0].get('tick'))

with self.raises(s_exc.IsReadOnly):
q = '[test:str=foo :hehe*unset=heval]'
nodes = await core.nodes(q, opts={'readonly': True})
Expand Down
14 changes: 14 additions & 0 deletions synapse/tests/test_lib_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,13 @@
'$pvar=stuff test:arrayprop +:$pvar*[=neato]',
'$pvar=ints test:arrayprop +:$pvar*[=$othervar]',
'$foo = ({"foo": ${ inet:fqdn }})',
'[test:str=foo :hehe*unset=heval]',
'[test:str=foo :hehe*$foo=heval]',
'[test:str=foo :$foo*unset=heval]',
'[test:str=foo :$foo*$bar=heval]',
'[test:str=foo :$foo*$bar.baz=heval]',
'[test:str=foo :$foo*$bar.("baz")=heval]',
'[test:str=foo :$foo*$bar.baz()=heval]',
]

# Generated with print_parse_list below
Expand Down Expand Up @@ -1358,6 +1365,13 @@
'Query: [SetVarOper: [Const: pvar, Const: stuff], LiftProp: [Const: test:arrayprop], FiltOper: [Const: +, ArrayCond: [RelProp: [VarValue: [Const: pvar]], Const: =, Const: neato]]]',
'Query: [SetVarOper: [Const: pvar, Const: ints], LiftProp: [Const: test:arrayprop], FiltOper: [Const: +, ArrayCond: [RelProp: [VarValue: [Const: pvar]], Const: =, VarValue: [Const: othervar]]]]',
'Query: [SetVarOper: [Const: foo, DollarExpr: [ExprDict: [Const: foo, EmbedQuery: inet:fqdn]]]]',
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [Const: hehe], CondSetOper: [Const: unset], Const: heval]]',
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [Const: hehe], CondSetOper: [VarValue: [Const: foo]], Const: heval]]',
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [VarValue: [Const: foo]], CondSetOper: [Const: unset], Const: heval]]',
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [VarValue: [Const: foo]], CondSetOper: [VarValue: [Const: bar]], Const: heval]]',
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [VarValue: [Const: foo]], CondSetOper: [VarDeref: [VarValue: [Const: bar], Const: baz]], Const: heval]]',
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [VarValue: [Const: foo]], CondSetOper: [VarDeref: [VarValue: [Const: bar], DollarExpr: [Const: baz]]], Const: heval]]',
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditCondPropSet: [RelProp: [VarValue: [Const: foo]], CondSetOper: [FuncCall: [VarDeref: [VarValue: [Const: bar], Const: baz], CallArgs: [], CallKwargs: []]], Const: heval]]',
]

class GrammarTest(s_t_utils.SynTest):
Expand Down

0 comments on commit 749d042

Please sign in to comment.