Skip to content

Commit

Permalink
🔖 version 0.50.1
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Jul 19, 2024
1 parent 0619c03 commit 7254b92
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/nonebot_plugin_alconna/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
from .uniseg import SupportAdapterModule as SupportAdapterModule
from .extension import add_global_extension as add_global_extension

__version__ = "0.50.0"
__version__ = "0.50.1"

__plugin_meta__ = PluginMetadata(
name="Alconna 插件",
Expand Down
2 changes: 1 addition & 1 deletion src/nonebot_plugin_alconna/pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
converter=converter,
alias=f"select({target.__name__})",
)
self.accept = lambda x: isinstance(x, target)
self.accept = lambda x: isinstance(x, Segment)

def match(self, input_: TS2):
if not self.accept(input_):
Expand Down
2 changes: 1 addition & 1 deletion src/nonebot_plugin_alconna/uniseg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
from .constraint import SupportAdapterModule as SupportAdapterModule
from .adapters import BUILDER_MAPPING, FETCHER_MAPPING, EXPORTER_MAPPING

__version__ = "0.50.0"
__version__ = "0.50.1"

__plugin_meta__ = PluginMetadata(
name="Universal Segment 插件",
Expand Down
9 changes: 8 additions & 1 deletion tests/test_uniseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ def test_uniseg():
Text("man").italic(0, 1),
]

assert select(Text).from_(Video).first.validate(Video(url="foobar")(Text("foobar"))).value() == Text("foobar")
pat = select(Text)
assert pat.first.validate(Text("foobar")).value() == Text("foobar")
assert pat.first.validate(Video(url="foobar")(Text("foobar"))).value() == Text("foobar")
assert pat.first.validate(Other(FallbackSegment.text("foobar"))(Text("foobar"))).value() == Text("foobar")
pat1 = select(Text).from_(Video)
assert pat1.first.validate(Text("foobar")).failed
assert pat1.first.validate(Video(url="foobar")(Text("foobar"))).value() == Text("foobar")
assert pat1.first.validate(Other(FallbackSegment.text("foobar"))(Text("foobar"))).failed


def test_unimsg():
Expand Down

0 comments on commit 7254b92

Please sign in to comment.