Esempio n. 1
0
    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'
Esempio n. 2
0
    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'
Esempio n. 3
0
    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
Esempio n. 4
0
    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
Esempio n. 5
0
    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
Esempio n. 7
0
    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
Esempio n. 8
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')
Esempio n. 9
0
    def test_finalize_options_grammar_options_language(self, command):
        command.grammar_options = 'language=Python3'
        command.finalize_options()

        assert command.grammar_options['language'] == 'Python3'
Esempio n. 10
0
    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
Esempio n. 11
0
    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')
Esempio n. 12
0
    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')
Esempio n. 13
0
    def test_finalize_options_grammars_single(self, command):
        command.grammars = 'Foo'
        command.finalize_options()

        assert 'Foo' in command.grammars
Esempio n. 14
0
    def test_finalize_options_grammars_single(self, command):
        command.grammars = 'Foo'
        command.finalize_options()

        assert 'Foo' in command.grammars
Esempio n. 15
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')
Esempio n. 16
0
    def test_finalize_options_grammar_options_language(self, command):
        command.grammar_options = 'language=Python3'
        command.finalize_options()

        assert command.grammar_options['language'] == 'Python3'
Esempio n. 17
0
    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')
Esempio n. 18
0
    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