From 65ae984cbfacb4eca6c03625b05656cfb69ecaf0 Mon Sep 17 00:00:00 2001 From: MarcSkovMadsen Date: Wed, 13 Nov 2024 14:48:52 +0000 Subject: [PATCH] fix --- .gitignore | 1 - param/parameterized.py | 3 ++- param/reactive.py | 6 ++++-- tests/testreactive.py | 9 +++++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 88d3bb41..fc5adc44 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,3 @@ benchmarks/param # pixi .pixi pixi.lock -script.* diff --git a/param/parameterized.py b/param/parameterized.py index 439fe211..190b77b5 100644 --- a/param/parameterized.py +++ b/param/parameterized.py @@ -1320,7 +1320,8 @@ def schema(self, safe=False, subset=None, mode='json'): @property def rx(self): - """The reactive namespace. + """ + The reactive namespace. Provides reactive versions of the operations that cannot be made reactive through overloading, such as `.rx.and_` and `.rx.bool`. Call it (`()`) to obtain a reactive expression. diff --git a/param/reactive.py b/param/reactive.py index 3920ef1b..d593173c 100644 --- a/param/reactive.py +++ b/param/reactive.py @@ -180,7 +180,8 @@ class NestedResolver(Resolver): class reactive_ops: - """The reactive namespace. + """ + The reactive namespace. Provides reactive versions of the operations that cannot be made reactive through overloading, such as `.rx.and_` and `.rx.bool`. Call it (`()`) to obtain a reactive expression. @@ -794,7 +795,8 @@ def __init__( @property def rx(self) -> reactive_ops: - """The reactive namespace. + """ + The reactive namespace. Provides reactive versions of the operations that cannot be made reactive through overloading, such as `.rx.and_` and `.rx.bool`. Call it (`()`) to obtain a reactive expression. diff --git a/tests/testreactive.py b/tests/testreactive.py index 68e6b9ee..97a4b6ca 100644 --- a/tests/testreactive.py +++ b/tests/testreactive.py @@ -4,6 +4,7 @@ import os import unittest import time +from textwrap import dedent try: import numpy as np @@ -24,8 +25,8 @@ import param import pytest -from param.parameterized import Skip -from param.reactive import bind, rx +from param.parameterized import Skip, Parameter +from param.reactive import bind, rx, reactive_ops from .utils import async_wait_until @@ -767,3 +768,7 @@ def test_reactive_callback_resolve_accessor(): dfx = rx(df) out = dfx["name"].str._callback() assert out is df["name"].str + +def test_docstrings_in_sync(): + assert dedent(reactive_ops.__doc__) == dedent(Parameter.rx.__doc__) + assert dedent(reactive_ops.__doc__) == dedent(rx.rx.__doc__)