Bug 2274503 - python-mathics-pygments fails to build with pytest 8: AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'
Summary: python-mathics-pygments fails to build with pytest 8: AttributeError: 'TestMa...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-mathics-pygments
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Davide Cavalca
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 2256331
TreeView+ depends on / blocked
 
Reported: 2024-04-11 12:29 UTC by Tomáš Hrnčiar
Modified: 2024-04-19 15:34 UTC (History)
3 users (show)

Fixed In Version: python-mathics-pygments-1.0.2-7.fc41
Clone Of:
Environment:
Last Closed: 2024-04-19 15:34:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2024-04-11 12:29:27 UTC
python-mathics-pygments fails to build with pytest 8.

=================================== FAILURES ===================================
______________________ TestMathematicaLexer.test_comments ______________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d94f170>

    def test_comments(self):
        code = '(* a comment *)'
        expected = [
            (MToken.COMMENT, '(*'),
            (MToken.COMMENT, ' a comment '),
            (MToken.COMMENT, '*)')
        ]
>       self.verify(code, expected)

tests/test_lexer.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d94f170>
code = '(* a comment *)'
expected = [(Token.Comment, '(*'), (Token.Comment, ' a comment '), (Token.Comment, '*)'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
_________________ TestMathematicaLexer.test_comments_with_code _________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d9b03e0>

    def test_comments_with_code(self):
        code = '(* Plot[Sin[x], {x, 0, 2 Pi}] *)'
        expected = [
            (MToken.COMMENT, '(*'),
            (MToken.COMMENT, ' Plot[Sin[x], {x, 0, 2 Pi}] '),
            (MToken.COMMENT, '*)')
        ]
>       self.verify(code, expected)

tests/test_lexer.py:42: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d9b03e0>
code = '(* Plot[Sin[x], {x, 0, 2 Pi}] *)'
expected = [(Token.Comment, '(*'), (Token.Comment, ' Plot[Sin[x], {x, 0, 2 Pi}] '), (Token.Comment, '*)'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
__________________ TestMathematicaLexer.test_nested_comments ___________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8440>

    def test_nested_comments(self):
        code = '(* foo (* bar *) baz *)'
        expected = [
            (MToken.COMMENT, '(*'),
            (MToken.COMMENT, ' foo '),
            (MToken.COMMENT, '(*'),
            (MToken.COMMENT, ' bar '),
            (MToken.COMMENT, '*)'),
            (MToken.COMMENT, ' baz '),
            (MToken.COMMENT, '*)'),
        ]
>       self.verify(code, expected)

tests/test_lexer.py:55: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8440>
code = '(* foo (* bar *) baz *)'
expected = [(Token.Comment, '(*'), (Token.Comment, ' foo '), (Token.Comment, '(*'), (Token.Comment, ' bar '), (Token.Comment, '*)'), (Token.Comment, ' baz '), ...]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
_________________ TestMathematicaLexer.test_multiline_comment __________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8590>

    def test_multiline_comment(self):
        code = '(* a comment\non two lines *)'
        expected = [
            (MToken.COMMENT, '(*'),
            (MToken.COMMENT, ' a comment\non two lines '),
            (MToken.COMMENT, '*)'),
        ]
>       self.verify(code, expected)

tests/test_lexer.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8590>
code = '(* a comment\non two lines *)'
expected = [(Token.Comment, '(*'), (Token.Comment, ' a comment\non two lines '), (Token.Comment, '*)'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
______________________ TestMathematicaLexer.test_strings _______________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8710>

    def test_strings(self):
        code = [
            '"a string"',
            '"a string \\" with a quote"',
            '"a string with a newline\\n"',
            '"a string with \\ two backslashes"',
        ]
        expected = [
            [
                (MToken.STRING, '"'),
                (MToken.STRING, 'a string'),
                (MToken.STRING, '"'),
            ],
            [
                (MToken.STRING, '"'),
                (MToken.STRING, 'a string '),
                (MToken.STRING, '\\"'),
                (MToken.STRING, ' with a quote'),
                (MToken.STRING, '"'),
            ],
            [
                (MToken.STRING, '"'),
                (MToken.STRING, 'a string with a newline'),
                (MToken.STRING, '\\n'),
                (MToken.STRING, '"'),
            ],
            [
                (MToken.STRING, '"'),
                (MToken.STRING, 'a string with '),
                (MToken.STRING, '\\'),
                (MToken.STRING, ' two backslashes'),
                (MToken.STRING, '"'),
            ]
        ]
>       self.verify_all(code, expected)

tests/test_lexer.py:100: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8710>
code = '"a string"'
expected = [(Token.Generic.Emph, '"'), (Token.Generic.Emph, 'a string'), (Token.Generic.Emph, '"'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
______________________ TestMathematicaLexer.test_integers ______________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8890>

    def test_integers(self):
        code = '123'
        expected = [(MToken.NUMBER, '123')]
>       self.verify(code, expected)

tests/test_lexer.py:105: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8890>
code = '123'
expected = [(Token.Literal.Number, '123'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
_______________________ TestMathematicaLexer.test_floats _______________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8a40>

    def test_floats(self):
        code = ['1.23', '10.1', '.123']
        expected = [[(MToken.NUMBER, num)] for num in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:110: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8a40>
code = '1.23'
expected = [(Token.Literal.Number, '1.23'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
_________________ TestMathematicaLexer.test_precision_numbers __________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8bc0>

    def test_precision_numbers(self):
        code = ['1`', '1.2`', '1.23`30', '20`20']
        expected = [[(MToken.NUMBER, num)] for num in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8bc0>
code = '1`'
expected = [(Token.Literal.Number, '1`'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
____________________ TestMathematicaLexer.test_base_numbers ____________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8e30>

    def test_base_numbers(self):
        code = ['2^^101', '8 ^^ 17', '10^^ 3.4']
        expected = [[(MToken.NUMBER, num)] for num in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:120: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c8e30>
code = '2^^101'
expected = [(Token.Literal.Number, '2^^101'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
_________________ TestMathematicaLexer.test_scientific_number __________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9040>

    def test_scientific_number(self):
        code = ['1*^3', '2 *^23', '1.23*^4']
        expected = [[(MToken.NUMBER, num)] for num in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:125: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9040>
code = '1*^3'
expected = [(Token.Literal.Number, '1*^3'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
______________________ TestMathematicaLexer.test_patterns ______________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c91c0>

    def test_patterns(self):
        code = [
            '_Head', '__Head', '___Head',
            'x_Head', 'x__Head', 'x___Head',
            'Foo`Bar_Head', 'Foo`Bar__Integer', 'Foo`Bar___Baz',
            'Foo`Bar_Ctx`Baz', 'Foo`Bar__Ctx`Baz', 'Foo`Bar___Ctx`Baz`Qux',
        ]
        expected = [[(MToken.PATTERN, pat)] for pat in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:135: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c91c0>
code = '_Head'
expected = [(Token.Name.Tag, '_Head'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
_______________________ TestMathematicaLexer.test_slots ________________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9310>

    def test_slots(self):
        code = ['#', '#1', '#234']
        expected = [[(MToken.SLOT, st)] for st in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:140: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9310>
code = '#'
expected = [(Token.Name.Function, '#'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
___________________ TestMathematicaLexer.test_slot_sequences ___________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9520>

    def test_slot_sequences(self):
        code = ['##', '##2', '##23']
        expected = [[(MToken.SLOT, st)] for st in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:145: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9520>
code = '##'
expected = [(Token.Name.Function, '##'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
_________________ TestMathematicaLexer.test_association_slots __________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9700>

    def test_association_slots(self):
        code = ['#foo', '#"foo"', '#foo`bar', '#Foo$1`Bar2$']
        expected = [[(MToken.SLOT, st)] for st in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:150: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9700>
code = '#foo'
expected = [(Token.Name.Function, '#foo'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
_____________________ TestMathematicaLexer.test_operators ______________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9850>

    def test_operators(self):
        code = mma.OPERATORS
        expected = [[(MToken.OPERATOR, op)] for op in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9850>
code = '!', expected = [(Token.Operator, '!'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
______________________ TestMathematicaLexer.test_symbols _______________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9c10>

    def test_symbols(self):
        code = ['foo', 'Foo', 'camelCase', 'Context`symbol', '`symbol', '$foo`bar', '$Bar`Baz`Qux']
        expected = [[(MToken.SYMBOL, sym)] for sym in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:183: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9c10>
code = 'foo'
expected = [(Token.Name.Variable, 'foo'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
________________________ TestMathematicaLexer.test_get _________________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9dc0>

    def test_get(self):
        code = ['<<Foo`', '<<Foo`Bar`']
        expected = [
            [
                (MToken.OPERATOR, '<<'),
                (MToken.SYMBOL, 'Foo`'),
            ],
            [
                (MToken.OPERATOR, '<<'),
                (MToken.SYMBOL, 'Foo`Bar`'),
            ]
        ]
>       self.verify_all(code, expected)

tests/test_lexer.py:197: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9dc0>
code = '<<Foo`'
expected = [(Token.Operator, '<<'), (Token.Name.Variable, 'Foo`'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
______________________ TestMathematicaLexer.test_builtins ______________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9f70>

    def test_builtins(self):
        code = list(mma.SYSTEM_SYMBOLS)
        expected = [[(MToken.BUILTIN, sym)] for sym in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:202: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9f70>
code = 'TreeGraph'
expected = [(Token.Name.Function, 'TreeGraph'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
__________________ TestMathematicaLexer.test_unicode_builtins __________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7ca120>

    def test_unicode_builtins(self):
        code = list(mma.UNICODE_SYSTEM_SYMBOLS)
        expected = [[(MToken.BUILTIN, sym)] for sym in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:207: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7ca120>
code = 'Ï€'
expected = [(Token.Name.Function, 'Ï€'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
_________________ TestMathematicaLexer.test_unicode_groupings __________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9970>

    def test_unicode_groupings(self):
        code = list(mma.UNICODE_GROUPINGS)
        expected = [[(MToken.GROUP, grp)] for grp in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:212: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9970>
code = '〈', expected = [(Token.Punctuation, '〈'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
_________________ TestMathematicaLexer.test_unicode_operators __________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7ca300>

    def test_unicode_operators(self):
        code = list(mma.UNICODE_OPERATORS)
        expected = [[(MToken.OPERATOR, op)] for op in code]
>       self.verify_all(code, expected)

tests/test_lexer.py:217: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7ca300>
code = '!', expected = [(Token.Operator, '!'), (Token.Text.Whitespace, '\n')]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
________________ TestMathematicaLexer.test_lexical_scope_simple ________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9b80>

    def test_lexical_scope_simple(self):
        code = [
            'Block[{x = 1}, Sin[x]]',
            'Module[{y := Cos[x]}, x + y]',
            'With[{$foo = 1}, f[$foo]]'
        ]
        expected = [
            [
                (MToken.BUILTIN, 'Block'),
                (MToken.GROUP, '['),
                (MToken.GROUP, '{'),
                (MToken.LOCAL_SCOPE, 'x'),
                (MToken.WHITESPACE, ' '),
                (MToken.OPERATOR, '='),
                (MToken.WHITESPACE, ' '),
                (MToken.NUMBER, '1'),
                (MToken.GROUP, '}'),
                (MToken.GROUP, ','),
                (MToken.WHITESPACE, ' '),
                (MToken.BUILTIN, 'Sin'),
                (MToken.GROUP, '['),
                (MToken.LOCAL_SCOPE, 'x'),
                (MToken.GROUP, ']'),
                (MToken.GROUP, ']'),
            ],
            [
                (MToken.BUILTIN, 'Module'),
                (MToken.GROUP, '['),
                (MToken.GROUP, '{'),
                (MToken.LOCAL_SCOPE, 'y'),
                (MToken.WHITESPACE, ' '),
                (MToken.OPERATOR, ':='),
                (MToken.WHITESPACE, ' '),
                (MToken.BUILTIN, 'Cos'),
                (MToken.GROUP, '['),
                (MToken.SYMBOL, 'x'),
                (MToken.GROUP, ']'),
                (MToken.GROUP, '}'),
                (MToken.GROUP, ','),
                (MToken.WHITESPACE, ' '),
                (MToken.SYMBOL, 'x'),
                (MToken.WHITESPACE, ' '),
                (MToken.OPERATOR, '+'),
                (MToken.WHITESPACE, ' '),
                (MToken.LOCAL_SCOPE, 'y'),
                (MToken.GROUP, ']'),
            ],
            [
                (MToken.BUILTIN, 'With'),
                (MToken.GROUP, '['),
                (MToken.GROUP, '{'),
                (MToken.LOCAL_SCOPE, '$foo'),
                (MToken.WHITESPACE, ' '),
                (MToken.OPERATOR, '='),
                (MToken.WHITESPACE, ' '),
                (MToken.NUMBER, '1'),
                (MToken.GROUP, '}'),
                (MToken.GROUP, ','),
                (MToken.WHITESPACE, ' '),
                (MToken.SYMBOL, 'f'),
                (MToken.GROUP, '['),
                (MToken.LOCAL_SCOPE, '$foo'),
                (MToken.GROUP, ']'),
                (MToken.GROUP, ']'),
            ],
        ]
>       self.verify_all(code, expected)

tests/test_lexer.py:291: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_lexer.py:24: in verify_all
    self.verify(code, expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9b80>
code = 'Block[{x = 1}, Sin[x]]'
expected = [(Token.Name.Function, 'Block'), (Token.Punctuation, '['), (Token.Punctuation, '{'), (Token.Name.Variable.Class, 'x'), (Token.Text.Whitespace, ' '), (Token.Operator, '='), ...]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
________________ TestMathematicaLexer.test_lexical_scope_nested ________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9640>

    def test_lexical_scope_nested(self):
        code = 'Block[{Plus = Times}, x + With[{y = 1}, 3 * y]]'
        expected = [
            (MToken.BUILTIN, 'Block'),
            (MToken.GROUP, '['),
            (MToken.GROUP, '{'),
            (MToken.LOCAL_SCOPE, 'Plus'),
            (MToken.WHITESPACE, ' '),
            (MToken.OPERATOR, '='),
            (MToken.WHITESPACE, ' '),
            (MToken.BUILTIN, 'Times'),
            (MToken.GROUP, '}'),
            (MToken.GROUP, ','),
            (MToken.WHITESPACE, ' '),
            (MToken.SYMBOL, 'x'),
            (MToken.WHITESPACE, ' '),
            (MToken.OPERATOR, '+'),
            (MToken.WHITESPACE, ' '),
            (MToken.BUILTIN, 'With'),
            (MToken.GROUP, '['),
            (MToken.GROUP, '{'),
            (MToken.LOCAL_SCOPE, 'y'),
            (MToken.WHITESPACE, ' '),
            (MToken.OPERATOR, '='),
            (MToken.WHITESPACE, ' '),
            (MToken.NUMBER, '1'),
            (MToken.GROUP, '}'),
            (MToken.GROUP, ','),
            (MToken.WHITESPACE, ' '),
            (MToken.NUMBER, '3'),
            (MToken.WHITESPACE, ' '),
            (MToken.OPERATOR, '*'),
            (MToken.WHITESPACE, ' '),
            (MToken.LOCAL_SCOPE, 'y'),
            (MToken.GROUP, ']'),
            (MToken.GROUP, ']'),
        ]
>       self.verify(code, expected)

tests/test_lexer.py:330: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9640>
code = 'Block[{Plus = Times}, x + With[{y = 1}, 3 * y]]'
expected = [(Token.Name.Function, 'Block'), (Token.Punctuation, '['), (Token.Punctuation, '{'), (Token.Name.Variable.Class, 'Plus'), (Token.Text.Whitespace, ' '), (Token.Operator, '='), ...]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
________________ TestMathematicaLexer.test_lexical_scope_nasty _________________

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9010>

    def test_lexical_scope_nasty(self):
        code = 'Block[{x=Module[{y=<|a->1,b->2|>},y],z=With[{k={1,2}},k*3]}, x+y*Block[{k=3},f[k]]]'
        expected = [
            (MToken.BUILTIN, 'Block'),
            (MToken.GROUP, '['),
            (MToken.GROUP, '{'),
            (MToken.LOCAL_SCOPE, 'x'),
            (MToken.OPERATOR, '='),
            (MToken.BUILTIN, 'Module'),
            (MToken.GROUP, '['),
            (MToken.GROUP, '{'),
            (MToken.LOCAL_SCOPE, 'y'),
            (MToken.OPERATOR, '='),
            (MToken.GROUP, '<|'),
            (MToken.SYMBOL, 'a'),
            (MToken.OPERATOR, '->'),
            (MToken.NUMBER, '1'),
            (MToken.GROUP, ','),
            (MToken.SYMBOL, 'b'),
            (MToken.OPERATOR, '->'),
            (MToken.NUMBER, '2'),
            (MToken.GROUP, '|>'),
            (MToken.GROUP, '}'),
            (MToken.GROUP, ','),
            (MToken.LOCAL_SCOPE, 'y'),
            (MToken.GROUP, ']'),
            (MToken.GROUP, ','),
            (MToken.LOCAL_SCOPE, 'z'),
            (MToken.OPERATOR, '='),
            (MToken.BUILTIN, 'With'),
            (MToken.GROUP, '['),
            (MToken.GROUP, '{'),
            (MToken.LOCAL_SCOPE, 'k'),
            (MToken.OPERATOR, '='),
            (MToken.GROUP, '{'),
            (MToken.NUMBER, '1'),
            (MToken.GROUP, ','),
            (MToken.NUMBER, '2'),
            (MToken.GROUP, '}'),
            (MToken.GROUP, '}'),
            (MToken.GROUP, ','),
            (MToken.LOCAL_SCOPE, 'k'),
            (MToken.OPERATOR, '*'),
            (MToken.NUMBER, '3'),
            (MToken.GROUP, ']'),
            (MToken.GROUP, '}'),
            (MToken.GROUP, ','),
            (MToken.WHITESPACE, ' '),
            (MToken.LOCAL_SCOPE, 'x'),
            (MToken.OPERATOR, '+'),
            (MToken.SYMBOL, 'y'),
            (MToken.OPERATOR, '*'),
            (MToken.BUILTIN, 'Block'),
            (MToken.GROUP, '['),
            (MToken.GROUP, '{'),
            (MToken.LOCAL_SCOPE, 'k'),
            (MToken.OPERATOR, '='),
            (MToken.NUMBER, '3'),
            (MToken.GROUP, '}'),
            (MToken.GROUP, ','),
            (MToken.SYMBOL, 'f'),
            (MToken.GROUP, '['),
            (MToken.LOCAL_SCOPE, 'k'),
            (MToken.GROUP, ']'),
            (MToken.GROUP, ']'),
            (MToken.GROUP, ']'),
        ]
>       self.verify(code, expected)

tests/test_lexer.py:399: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_lexer.TestMathematicaLexer object at 0x7fd93d7c9010>
code = 'Block[{x=Module[{y=<|a->1,b->2|>},y],z=With[{k={1,2}},k*3]}, x+y*Block[{k=3},f[k]]]'
expected = [(Token.Name.Function, 'Block'), (Token.Punctuation, '['), (Token.Punctuation, '{'), (Token.Name.Variable.Class, 'x'), (Token.Operator, '='), (Token.Name.Function, 'Module'), ...]

    def verify(self, code, expected):
        expected.append((Token.Text.Whitespace, '\n'))
>       returned = list(self.lexer.get_tokens(code))
E       AttributeError: 'TestMathematicaLexer' object has no attribute 'lexer'

tests/test_lexer.py:19: AttributeError
=========================== short test summary info ============================
FAILED tests/test_lexer.py::TestMathematicaLexer::test_comments - AttributeEr...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_comments_with_code - A...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_nested_comments - Attr...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_multiline_comment - At...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_strings - AttributeErr...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_integers - AttributeEr...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_floats - AttributeErro...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_precision_numbers - At...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_base_numbers - Attribu...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_scientific_number - At...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_patterns - AttributeEr...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_slots - AttributeError...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_slot_sequences - Attri...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_association_slots - At...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_operators - AttributeE...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_symbols - AttributeErr...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_get - AttributeError: ...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_builtins - AttributeEr...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_unicode_builtins - Att...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_unicode_groupings - At...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_unicode_operators - At...
FAILED tests/test_lexer.py::TestMathematicaLexer::test_lexical_scope_simple
FAILED tests/test_lexer.py::TestMathematicaLexer::test_lexical_scope_nested
FAILED tests/test_lexer.py::TestMathematicaLexer::test_lexical_scope_nasty - ...
======================== 24 failed, 2 skipped in 0.35s =========================

https://docs.pytest.org/en/stable/changelog.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/thrnciar/pytest/fedora-rawhide-x86_64/07248354-python-mathics-pygments/

For all our attempts to build python-mathics-pygments with pytest 8, see:
https://copr.fedorainfracloud.org/coprs/thrnciar/pytest/package/python-mathics-pygments/

Let us know here if you have any questions.

Pytest 8 is planned to be included in Fedora 41. And this bugzilla is a
heads up before we merge new pytest into rawhide. For more info see a Fedora Change
proposal https://fedoraproject.org/wiki/Changes/Pytest_8

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.


Note You need to log in before you can comment on or make changes to this bug.