def test_finalize_options_grammar_options_multiple(self, command): command.grammar_options = 'superClass=Abc tokenVocab=Lexer' command.finalize_options() assert command.grammar_options['language'] == 'Python3' assert command.grammar_options['superClass'] == 'Abc' assert command.grammar_options['tokenVocab'] == 'Lexer'
def test_finalize_options_debugging_options_invalid(self, capsys, command): command.x_dbg_st = 0 command.x_dbg_st_wait = 1 command.finalize_options() # check if error was logged _, err = capsys.readouterr() assert 'Waiting for StringTemplate visualizer' in err
def test_finalize_options_custom_output_dir(self, command): command.output = 'Foo=build/lib/custom' command.finalize_options() assert pathlib.Path( command.output['default']) == pathlib.Path('build/lib') assert pathlib.Path( command.output['Foo']) == pathlib.Path('build/lib/custom')
def test_finalize_options_default(self, command): command.finalize_options() assert command.grammars is None assert pathlib.Path(command.output['default']) == pathlib.Path('.') assert command.atn == 0 assert command.encoding is None assert command.message_format is None assert command.long_messages == 0 assert command.listener == 1 assert command.visitor == 0 assert command.depend == 0 assert command.grammar_options['language'] == 'Python3' assert command.w_error == 0 assert command.x_dbg_st == 0 assert command.x_dbg_st_wait == 0 assert command.x_force_atn == 0 assert command.x_log == 0
def test_finalize_options_grammar_options_invalid(self, command): command.grammar_options = 'language=Java' with pytest.raises(distutils.errors.DistutilsOptionError) as excinfo: command.finalize_options() assert excinfo.match('Java')
def test_finalize_options_grammar_options_language(self, command): command.grammar_options = 'language=Python3' command.finalize_options() assert command.grammar_options['language'] == 'Python3'
def test_finalize_options_grammars_multiple(self, command): command.grammars = 'Foo Bar' command.finalize_options() assert 'Foo' in command.grammars assert 'Bar' in command.grammars
def test_finalize_options_default_output_dir(self, command): command.output = 'default=build/lib' command.finalize_options() assert pathlib.Path( command.output['default']) == pathlib.Path('build/lib')
def test_finalize_options_custom_default_output_dir(self, command): command.output = 'default=custom' command.finalize_options() assert pathlib.Path( command.output['default']) == pathlib.Path('custom')
def test_finalize_options_grammars_single(self, command): command.grammars = 'Foo' command.finalize_options() assert 'Foo' in command.grammars
def test_finalize_options_custom_default_output_dir(self, command): command.output = 'default=custom' command.finalize_options() assert pathlib.Path(command.output['default']) == pathlib.Path('custom')