Skip to content

test failures in 0.7.2; test_simple, test_empty_production under py3[3-4] #26

Description

@idella

from the source, with system python set to Python 3.3.5;

rply-0.7.2 $ py.test tests/

yields

======================== test session starts
========================
platform linux -- Python 3.3.5 -- py-1.4.20 -- pytest-2.5.2
collected 35 items / 1 skipped

tests/test_both.py .
tests/test_lexer.py ...
tests/test_parser.py ..........
tests/test_parsergenerator.py FF.......
tests/test_tokens.py ...
tests/test_utils.py .....
tests/test_warnings.py ....

========================== FAILURES
==========================
_________________________ TestParserGenerator.test_simple
_________________________
self = <tests.test_parsergenerator.TestParserGenerator object at 0x7fcbc174e850>

    def test_simple(self):
        pg = ParserGenerator(["VALUE"])

        @pg.production("main : VALUE")
        def main(p):
            return p[0]

        parser = pg.build()

>       assert parser.lr_table.lr_action == [
            {"VALUE": 2},
            {"$end": 0},
            {"$end": -1},
        ]
E       assert [{'VALUE': 1}..., {'$end': 0}] == [{'VALUE': 2},... {'$end': -1}]
E         At index 0 diff: {'VALUE': 1} != {'VALUE': 2}

tests/test_parsergenerator.py:19: AssertionError
______________________ TestParserGenerator.test_empty_production
______________________

self = <tests.test_parsergenerator.TestParserGenerator object at 0x7fcbbeac9b50>
    def test_empty_production(self):
        pg = ParserGenerator(["VALUE"])

        @pg.production("main : values")
        def main(p):
            return p[0]

        @pg.production("values : VALUE values")
        def values_value(p):
            return [p[0]] + p[1]

        @pg.production("values :")
        def values_empty(p):
            return []

        parser = pg.build()
>       assert parser.lr_table.lr_action == [
            {"$end": -3, "VALUE": 3},
            {"$end": 0},
            {"$end": -1},
            {"$end": -3, "VALUE": 3},
            {"$end": -2},
        ]
E       assert [{'$end': -3,... {'$end': -2}] == [{'$end': -3, ... {'$end': -2}]
E         At index 0 diff: {'VALUE': 1, '$end': -3} != {'VALUE': 3, '$end': -3}

with system Python 3.4.0

tests/test_parsergenerator.py FF.......

__ TestParserGenerator.test_simple __

as for Python 3.3.5

__ TestParserGenerator.test_empty_production __

>       assert parser.lr_table.lr_action == [
            {"$end": -3, "VALUE": 3},
            {"$end": 0},
            {"$end": -1},
            {"$end": -3, "VALUE": 3},
            {"$end": -2},
        ]
E       assert [{'$end': -3,... {'$end': -2}] == [{'$end': -3, ... {'$end': -2}]
E         At index 0 diff: {'VALUE': 2, '$end': -3} != {'$end': -3, 'VALUE': 3}

tests/test_parsergenerator.py:41: AssertionError

Can you replicate? py3.2 passes fine. These may be python minor version sensitive.
Do you require anything further?

Activity

  1. alex commented on Apr 24, 2014

    @alex
    Owner

    The tests failures appear to be a result of the hash randomization in Python 3.3+ (using the -R flag on Python 2 reprocuces these issues IIRC). I don't believe the test failures indicate a bug, although it would be nice to fix them, I'm not sure what that fix looks like.

  2. nobodxbodon commented on Sep 7, 2020

    @nobodxbodon
    Contributor

    FYI non-rpython tests pass for the latest commit 41d7483 , with Python 3.7.6:

    $ pytest tests
    ================================================================= test session starts ==================================================================
    platform darwin -- Python 3.7.6, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
    rootdir: /[omitted]/rply
    plugins: hypothesis-5.5.4, arraydiff-0.3, remotedata-0.3.2, openfiles-0.4.0, doctestplus-0.5.0, astropy-header-0.1.2
    collected 49 items                                                                                                                                     
    
    tests/test_both.py .                                                                                                                             [  2%]
    tests/test_lexer.py ..........                                                                                                                   [ 22%]
    tests/test_parser.py ..........                                                                                                                  [ 42%]
    tests/test_parsergenerator.py ........                                                                                                           [ 59%]
    tests/test_tokens.py .....                                                                                                                       [ 69%]
    tests/test_utils.py .....                                                                                                                        [ 79%]
    tests/test_warnings.py ....                                                                                                                      [ 87%]
    tests/test_ztranslation.py ssssss                                                                                                                [100%]
    
    ============================================================ 43 passed, 6 skipped in 0.21s ============================================================
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions