Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add testing for rcParams Literal type hints#30705

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
QuLogic wants to merge2 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromQuLogic:rc-type-test
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
import re
import typing
from pathlib import Path

import matplotlib.pyplot as plt
from matplotlib.colors import Colormap
from matplotlib.typing import RcKeyType, RcGroupKeyType


def test_cm_stub_matches_runtime_colormaps():
Expand DownExpand Up@@ -30,3 +32,20 @@ def test_cm_stub_matches_runtime_colormaps():
)

assert runtime_cmaps == stubbed_cmaps


def test_rcparam_stubs():
runtime_rc_keys = {
name for name in plt.rcParamsDefault.keys()
if not name.startswith('_')
}

assert {*typing.get_args(RcKeyType)} == runtime_rc_keys

runtime_rc_group_keys = set()
for name in runtime_rc_keys:
groups = name.split('.')
for i in range(1, len(groups)):
runtime_rc_group_keys.add('.'.join(groups[:i]))

assert {*typing.get_args(RcGroupKeyType)} == runtime_rc_group_keys
18 changes: 16 additions & 2 deletionslib/matplotlib/typing.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -217,6 +217,8 @@
"axes.ymargin",
"axes.zmargin",
"axes3d.automargin",
"axes3d.depthshade",
"axes3d.depthshade_minalpha",
"axes3d.grid",
"axes3d.mouserotationstyle",
"axes3d.trackballborder",
Expand DownExpand Up@@ -304,6 +306,7 @@
"figure.titlesize",
"figure.titleweight",
"font.cursive",
"font.enable_last_resort",
"font.family",
"font.fantasy",
"font.monospace",
Expand All@@ -318,6 +321,14 @@
"grid.color",
"grid.linestyle",
"grid.linewidth",
"grid.major.alpha",
"grid.major.color",
"grid.major.linestyle",
"grid.major.linewidth",
"grid.minor.alpha",
"grid.minor.color",
"grid.minor.linestyle",
"grid.minor.linewidth",
"hatch.color",
"hatch.linewidth",
"hist.bins",
Expand DownExpand Up@@ -492,7 +503,7 @@
"ytick.minor.size",
"ytick.minor.visible",
"ytick.minor.width",
"ytick.right"
"ytick.right",
]

RcGroupKeyType: TypeAlias = Literal[
Expand DownExpand Up@@ -524,6 +535,8 @@
"figure.subplot",
"font",
"grid",
"grid.major",
"grid.minor",
"hatch",
"hist",
"image",
Expand All@@ -546,6 +559,7 @@
"scatter",
"svg",
"text",
"text.latex",
"tk",
"webagg",
"xaxis",
Expand All@@ -555,5 +569,5 @@
"yaxis",
"ytick",
"ytick.major",
"ytick.minor"
"ytick.minor",
]
Loading

[8]ページ先頭

©2009-2025 Movatter.jp