File: test_2652.py

package info (click to toggle)
python-parsl 2025.01.13%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,072 kB
  • sloc: python: 23,817; makefile: 349; sh: 276; ansic: 45
file content (28 lines) | stat: -rw-r--r-- 848 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pytest

from parsl.jobs.states import JobState


@pytest.mark.local
def test_JobStatus_repr():
    # in Python 3.11, the behavior of enums changed a bit, and so repr
    # (inherited from a superclass) raised an exception rather than
    # returning a string.

    # This test checks that repr returns some string value - it does
    # not validate that that string is some expected value.

    j = JobState.COMPLETED

    # this repr call started raising exceptions with python 3.11
    # prior to the #2652 bugfix.
    r = repr(j)
    assert isinstance(r, str)

    s = str(j)
    assert isinstance(s, str)

    # IntEnum changed behaviour from python 3.10 -> 3.10 so as to return
    # an integer. This checks that the JobState enum implementation
    # returns a name string on all tested platforms.
    assert s == "JobState.COMPLETED"