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

Remove redundant Python 3.6 code #2575

Merged
merged 2 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions CONTRIBUTORS.md
Expand Up @@ -2,7 +2,7 @@

The following people have contributed to the development of Rich:

<!-- Add your name below, sort alphabetically by surname. Link to Github profile / your home page. -->
<!-- Add your name below, sort alphabetically by surname. Link to GitHub profile / your home page. -->

- [Patrick Arminio](https://github.com/patrick91)
- [Gregory Beauregard](https://github.com/GBeauregard/pyffstream)
Expand All @@ -21,6 +21,7 @@ The following people have contributed to the development of Rich:
- [Lanqing Huang](https://github.com/lqhuang)
- [Finn Hughes](https://github.com/finnhughes)
- [Josh Karpel](https://github.com/JoshKarpel)
- [Hugo van Kemenade](https://github.com/hugovk)
- [Andrew Kettmann](https://github.com/akettmann)
- [Martin Larralde](https://github.com/althonos)
- [Hedy Li](https://github.com/hedythedev)
Expand Down Expand Up @@ -55,4 +56,4 @@ The following people have contributed to the development of Rich:
- [Motahhar Mokfi](https://github.com/motahhar)
- [Tomer Shalev](https://github.com/tomers)
- [Serkan UYSAL](https://github.com/uysalserkan)
- [Zhe Huang](https://github.com/onlyacat)
- [Zhe Huang](https://github.com/onlyacat)
3 changes: 1 addition & 2 deletions rich/pretty.py
Expand Up @@ -642,7 +642,6 @@ def _traverse(obj: Any, root: bool = False, depth: int = 0) -> Node:
return Node(value_repr="...")

obj_type = type(obj)
py_version = (sys.version_info.major, sys.version_info.minor)
children: List[Node]
reached_max_depth = max_depth is not None and depth >= max_depth

Expand Down Expand Up @@ -780,7 +779,7 @@ def iter_attrs() -> Iterable[
is_dataclass(obj)
and not _safe_isinstance(obj, type)
and not fake_attributes
and (_is_dataclass_repr(obj) or py_version == (3, 6))
and _is_dataclass_repr(obj)
):
push_visited(obj_id)
children = []
Expand Down
13 changes: 0 additions & 13 deletions tests/test_inspect.py
Expand Up @@ -13,11 +13,6 @@
)
from rich.console import Console

skip_py36 = pytest.mark.skipif(
sys.version_info.minor == 6 and sys.version_info.major == 3,
reason="rendered differently on py3.6",
)

skip_py37 = pytest.mark.skipif(
sys.version_info.minor == 7 and sys.version_info.major == 3,
reason="rendered differently on py3.7",
Expand Down Expand Up @@ -89,7 +84,6 @@ class FooSubclass(Foo):
pass


@skip_py36
def test_render():
console = Console(width=100, file=io.StringIO(), legacy_windows=False)

Expand Down Expand Up @@ -118,7 +112,6 @@ def test_inspect_text():
assert render("Hello") == expected


@skip_py36
@skip_py37
@skip_pypy3
def test_inspect_empty_dict():
Expand Down Expand Up @@ -194,7 +187,6 @@ async def coroutine():
assert render(coroutine).startswith(expected)


@skip_py36
def test_inspect_integer():
expected = (
"╭────── <class 'int'> ───────╮\n"
Expand All @@ -210,15 +202,13 @@ def test_inspect_integer():
assert expected == render(1)


@skip_py36
def test_inspect_integer_with_value():
expected = "╭────── <class 'int'> ───────╮\n│ int([x]) -> integer │\n│ int(x, base=10) -> integer │\n│ │\n│ ╭────────────────────────╮ │\n│ │ 1 │ │\n│ ╰────────────────────────╯ │\n│ │\n│ denominator = 1 │\n│ imag = 0 │\n│ numerator = 1 │\n│ real = 1 │\n╰────────────────────────────╯\n"
value = render(1, value=True)
print(repr(value))
assert value == expected


@skip_py36
@skip_py37
@skip_py310
@skip_py311
Expand Down Expand Up @@ -255,7 +245,6 @@ def test_inspect_integer_with_methods_python38_and_python39():
assert render(1, methods=True) == expected


@skip_py36
@skip_py37
@skip_py38
@skip_py39
Expand Down Expand Up @@ -297,7 +286,6 @@ def test_inspect_integer_with_methods_python310only():
assert render(1, methods=True) == expected


@skip_py36
@skip_py37
@skip_py38
@skip_py39
Expand Down Expand Up @@ -341,7 +329,6 @@ def test_inspect_integer_with_methods_python311_and_above():
assert render(1, methods=True) == expected


@skip_py36
@skip_py37
@skip_pypy3
def test_broken_call_attr():
Expand Down
11 changes: 1 addition & 10 deletions tests/test_pretty.py
Expand Up @@ -4,7 +4,7 @@
from array import array
from collections import UserDict, defaultdict
from dataclasses import dataclass, field
from typing import List, NamedTuple, Any
from typing import Any, List, NamedTuple
from unittest.mock import patch

import attr
Expand All @@ -15,11 +15,6 @@
from rich.pretty import Node, Pretty, _ipy_display_hook, install, pprint, pretty_repr
from rich.text import Text

skip_py36 = pytest.mark.skipif(
sys.version_info.minor == 6 and sys.version_info.major == 3,
reason="rendered differently on py3.6",
)

skip_py37 = pytest.mark.skipif(
sys.version_info.minor == 7 and sys.version_info.major == 3,
reason="rendered differently on py3.7",
Expand Down Expand Up @@ -289,7 +284,6 @@ def __repr__(self):
assert result == "Hello World!\n"


@skip_py36
def test_broken_repr():
class BrokenRepr:
def __repr__(self):
Expand All @@ -301,7 +295,6 @@ def __repr__(self):
assert result == expected


@skip_py36
def test_broken_getattr():
class BrokenAttr:
def __getattr__(self, name):
Expand Down Expand Up @@ -618,7 +611,6 @@ class Nada:
assert result == expected


@skip_py36
@skip_py310
@skip_py311
def test_attrs_broken():
Expand All @@ -634,7 +626,6 @@ class Foo:
assert result == expected


@skip_py36
@skip_py37
@skip_py38
@skip_py39
Expand Down
12 changes: 3 additions & 9 deletions tests/test_repr.py
@@ -1,15 +1,10 @@
import pytest
import sys
from typing import Optional

from rich.console import Console
import rich.repr

import pytest

skip_py36 = pytest.mark.skipif(
sys.version_info.minor == 6 and sys.version_info.major == 3,
reason="rendered differently on py3.6",
)
import rich.repr
from rich.console import Console

skip_py37 = pytest.mark.skipif(
sys.version_info.minor == 7 and sys.version_info.major == 3,
Expand Down Expand Up @@ -71,7 +66,6 @@ def test_rich_repr() -> None:
assert (repr(Foo("hello", bar=3))) == "Foo('hello', 'hello', bar=3, egg=1)"


@skip_py36
@skip_py37
def test_rich_repr_positional_only() -> None:
_locals = locals().copy()
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -3,7 +3,7 @@ minversion = 3.9.0
envlist =
lint
docs
py{36,37,38,39}
py{37,38,39,310}
isolated_build = True

[testenv]
Expand Down