<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> from salttesting import TestCase <EOL> from salttesting . helpers import ensure_in_syspath <EOL> ensure_in_syspath ( '<STR_LIT>' ) <EOL> from salt . utils import format_call <EOL> from salt . exceptions import SaltInvocationError <EOL> class TestFormatCall ( TestCase ) : <EOL> def test_simple_args_passing ( self ) : <EOL> def foo ( one , two = <NUM_LIT:2> , three = <NUM_LIT:3> ) : <EOL> pass <EOL> self . assertEqual ( <EOL> format_call ( foo , dict ( one = <NUM_LIT:10> , two = <NUM_LIT:20> , three = <NUM_LIT:30> ) ) , <EOL> { '<STR_LIT:args>' : [ <NUM_LIT:10> ] , '<STR_LIT>' : dict ( two = <NUM_LIT:20> , three = <NUM_LIT:30> ) } <EOL> ) <EOL> self . assertEqual ( <EOL> format_call ( foo , dict ( one = <NUM_LIT:10> , two = <NUM_LIT:20> ) ) , <EOL> { '<STR_LIT:args>' : [ <NUM_LIT:10> ] , '<STR_LIT>' : dict ( two = <NUM_LIT:20> , three = <NUM_LIT:3> ) } <EOL> ) <EOL> self . assertEqual ( <EOL> format_call ( foo , dict ( one = <NUM_LIT:2> ) ) , <EOL> { '<STR_LIT:args>' : [ <NUM_LIT:2> ] , '<STR_LIT>' : dict ( two = <NUM_LIT:2> , three = <NUM_LIT:3> ) } <EOL> ) <EOL> def test_mimic_typeerror_exceptions ( self ) : <EOL> def foo ( one , two = <NUM_LIT:2> , three = <NUM_LIT:3> ) : <EOL> pass <EOL> def foo2 ( one , two , three = <NUM_LIT:3> ) : <EOL> pass <EOL> with self . assertRaisesRegexp ( <EOL> SaltInvocationError , <EOL> r'<STR_LIT>' ) : <EOL> format_call ( foo , dict ( two = <NUM_LIT:3> ) ) <EOL> with self . assertRaisesRegexp ( <EOL> TypeError , <EOL> r'<STR_LIT>' ) : <EOL> format_call ( foo2 , dict ( one = <NUM_LIT:1> ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from integration import run_tests <EOL> run_tests ( TestFormatCall , needs_daemon = False ) </s>
