Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure on Python 3.11 #18

Open
musicinmybrain opened this issue Jun 20, 2022 · 0 comments
Open

Test failure on Python 3.11 #18

musicinmybrain opened this issue Jun 20, 2022 · 0 comments

Comments

@musicinmybrain
Copy link

======================================================= ERRORS =======================================================
_______________________________________ ERROR collecting test/test_ansiwrap.py _______________________________________
test/test_ansiwrap.py:23: in <module>
    other_lengths = (random.sample(set(range(20, 120)).difference(LINE_LENGTHS), 2) +
        ANSIState  = <class 'ansiwrap.ansistate.ANSIState'>
        COLORS     = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', ...)
        LINE_LENGTHS = [20, 27, 40, 41, 42, 43, ...]
        STYLES     = ('none', 'bold', 'faint', 'italic', 'underline', 'blink', ...)
        VERSION    = (3, 11)
        _PY2       = False
        __builtins__ = <builtins>
        __cached__ = '/home/ben/src/forks/ansiwrap/test/__pycache__/test_ansiwrap.cpython-311.pyc'
        __doc__    = None
        __file__   = '/home/ben/src/forks/ansiwrap/test/test_ansiwrap.py'
        __loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7facd25b7210>
        __name__   = 'test_ansiwrap'
        __package__ = ''
        __spec__   = ModuleSpec(name='test_ansiwrap', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7facd25b7210>, origin='/home/ben/src/forks/ansiwrap/test/test_ansiwrap.py')
        _ansi_optimize = <function _ansi_optimize at 0x7facd260b7e0>
        absolute_import = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0), 262144)
        ansi_terminate_lines = <function ansi_terminate_lines at 0x7facd260b880>
        ansilen    = <function ansilen at 0x7facd2609b20>
        ansistate  = <module 'ansiwrap.ansistate' from '/home/ben/src/forks/ansiwrap/.tox/py311/lib/python3.11/site-packages/ansiwrap/ansistate.py'>
        black      = functools.partial(<function color at 0x7facd2609620>, fg='black')
        blink      = functools.partial(<function color at 0x7facd2609620>, style='blink')
        blink2     = functools.partial(<function color at 0x7facd2609620>, style='blink2')
        blue       = functools.partial(<function color at 0x7facd2609620>, fg='blue')
        bold       = functools.partial(<function color at 0x7facd2609620>, style='bold')
        color      = <function color at 0x7facd2609620>
        colors     = <module 'colors.colors' from '/home/ben/src/forks/ansiwrap/.tox/py311/lib/python3.11/site-packages/colors/colors.py'>
        concealed  = functools.partial(<function color at 0x7facd2609620>, style='concealed')
        core       = <module 'ansiwrap.core' from '/home/ben/src/forks/ansiwrap/.tox/py311/lib/python3.11/site-packages/ansiwrap/core.py'>
        crossed    = functools.partial(<function color at 0x7facd2609620>, style='crossed')
        css_colors = {'aliceblue': (240, 248, 255), 'antiquewhite': (250, 235, 215), 'aqua': (0, 255, 255), 'aquamarine': (127, 255, 212), ...}
        csscolors  = <module 'colors.csscolors' from '/home/ben/src/forks/ansiwrap/.tox/py311/lib/python3.11/site-packages/colors/csscolors.py'>
        cyan       = functools.partial(<function color at 0x7facd2609620>, fg='cyan')
        faint      = functools.partial(<function color at 0x7facd2609620>, style='faint')
        fill       = <function fill at 0x7facd260b740>
        green      = functools.partial(<function color at 0x7facd2609620>, fg='green')
        is_string  = <function is_string at 0x7facd26093a0>
        italic     = functools.partial(<function color at 0x7facd2609620>, style='italic')
        magenta    = functools.partial(<function color at 0x7facd2609620>, fg='magenta')
        negative   = functools.partial(<function color at 0x7facd2609620>, style='negative')
        none       = functools.partial(<function color at 0x7facd2609620>, style='none')
        parse_rgb  = <function parse_rgb at 0x7facd26094e0>
        partial    = <class 'functools.partial'>
        print_function = _Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 1048576)
        pytest     = <module 'pytest' from '/home/ben/src/forks/ansiwrap/.tox/py311/lib/python3.11/site-packages/pytest/__init__.py'>
        random     = <module 'random' from '/usr/lib64/python3.11/random.py'>
        re         = <module 're' from '/usr/lib64/python3.11/re/__init__.py'>
        red        = functools.partial(<function color at 0x7facd2609620>, fg='red')
        shorten    = <function shorten at 0x7facd260b920>
        string_types = <class 'str'>
        strip_color = <function strip_color at 0x7facd260ac00>
        sys        = <module 'sys' (built-in)>
        textwrap   = <module 'textwrap3' from '/home/ben/src/forks/ansiwrap/.tox/py311/lib/python3.11/site-packages/textwrap3.py'>
        underline  = functools.partial(<function color at 0x7facd2609620>, style='underline')
        version    = <module 'colors.version' from '/home/ben/src/forks/ansiwrap/.tox/py311/lib/python3.11/site-packages/colors/version.py'>
        white      = functools.partial(<function color at 0x7facd2609620>, fg='white')
        wrap       = <function wrap at 0x7facd260b6a0>
        yellow     = functools.partial(<function color at 0x7facd2609620>, fg='yellow')
/usr/lib64/python3.11/random.py:436: in sample
    raise TypeError("Population must be a sequence.  "
E   TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).
        counts     = None
        k          = 2
        population = {21, 22, 23, 24, 25, 26, ...}
        self       = <random.Random object at 0x56475e972100>

The diagnostic is pretty self-explanatory. The problem is in the test, not in the library. PR to follow.

musicinmybrain added a commit to musicinmybrain/ansiwrap that referenced this issue Jun 20, 2022
random.sample() population must be a sequence
musicinmybrain added a commit to musicinmybrain/ansiwrap that referenced this issue Apr 10, 2023
random.sample() population must be a sequence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant