rich icon indicating copy to clipboard operation
rich copied to clipboard

Tests adjustments needed for compatibility with Python 3.12

Open hrnciar opened this issue 2 years ago • 3 comments

Type of changes

  • [ ] Bug fix
  • [ ] New feature
  • [ ] Documentation / docstrings
  • [x] Tests
  • [ ] Other

Checklist

  • [x] I've run the latest black with default args on new code.
  • [ ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate. (No changes made to Changelog, not sure if this is Changelog-worthy).
  • [ ] I've added tests for new code.
  • [x] I accept that @willmcgugan may be pedantic in the code review.

Description

Some tests are failing with Python 3.12, since they were skipped also on 3.11 I suppose it's okay to skip them on 3.12 as well.

hrnciar avatar May 19 '23 06:05 hrnciar

I've added another commit to fix an error in:

____________ test_inspect_integer_with_methods_python311_and_above _____________
...
E           ╭──────────────── <class 'int'> ─────────────────╮
E           │ int([x]) -> integer                            │
E           │ int(x, base=10) -> integer                     │
E           │                                                │
E           │      denominator = 1                           │
E           │             imag = 0                           │
E           │        numerator = 1                           │
E           │             real = 1                           │
E           │ as_integer_ratio = def as_integer_ratio():     │
E         - │                    Return integer ratio.       │
E         ?                                    ^^^^^^^^^^^^
E         + │                    Return a pair of integers,  │
E         ?                            ++++++++++        ^^
E         + │                    whose ratio is equal to the │
E         + │                    original int.               │
E           │        bit_count = def bit_count(): Number of  │
E           │                    ones in the binary          │
E           │                    representation of the       │
E           │                    absolute value of self.     │
E           │       bit_length = def bit_length(): Number of │
E           │                    bits necessary to represent │
E           │                    self in binary.             │
E           │        conjugate = def conjugate(...) Returns  │
E           │                    self, the complex conjugate │
E           │                    of any int.                 │
E           │       from_bytes = def from_bytes(bytes,       │
E           │                    byteorder='big', *,         │
E           │                    signed=False): Return the   │
E           │                    integer represented by the  │
E           │                    given array of bytes.       │
E         + │       is_integer = def is_integer(): Returns   │
E         + │                    True. Exists for duck type  │
E         + │                    compatibility with          │
E         + │                    float.is_integer.           │
E           │         to_bytes = def to_bytes(length=1,      │
E           │                    byteorder='big', *,         │
E           │                    signed=False): Return an    │
E           │                    array of bytes representing │
E           │                    an integer.                 │
E           ╰────────────────────────────────────────────────╯

tests/test_inspect.py:337: AssertionError

hrnciar avatar May 19 '23 07:05 hrnciar

Reminder: Python 3.12 is due out in 3 weeks, on 2023-10-02.

https://peps.python.org/pep-0693/

hugovk avatar Sep 13 '23 17:09 hugovk

@willmcgugan any chance you can have a look at this PR? debian is trying to deploy 3.12 in the distribution and currently rich/13.7.0 fails its tests when running 3.12.1 (it works fine with pyton/3.11)

Thanks!

sandrotosi avatar Jan 12 '24 07:01 sandrotosi

Assuming stale, tests are running on 3.12 now. Thanks for the PR.

willmcgugan avatar Jul 01 '24 12:07 willmcgugan