예제 #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'
예제 #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'
예제 #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
예제 #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
예제 #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')
예제 #6
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
예제 #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
예제 #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')
예제 #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'
예제 #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
예제 #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')
예제 #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')
예제 #13
0
    def test_finalize_options_grammars_single(self, command):
        command.grammars = 'Foo'
        command.finalize_options()

        assert 'Foo' in command.grammars
예제 #14
0
    def test_finalize_options_grammars_single(self, command):
        command.grammars = 'Foo'
        command.finalize_options()

        assert 'Foo' in command.grammars
예제 #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')
예제 #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'
예제 #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')
예제 #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