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

Appearance settings

Commit 3bd288e

Browse filesBrowse files
committed
tests(lookup_exact): Use operator, add doctest
1 parent ad82fdc commit 3bd288e
Copy full SHA for 3bd288e

File tree

Expand file treeCollapse file tree

1 file changed

+10
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-2
lines changed

‎libvcs/_internal/query_list.py

Copy file name to clipboardExpand all lines: libvcs/_internal/query_list.py
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
----
55
This is an internal API not covered by versioning policy.
66
"""
7+
import operator
78
import re
89
import traceback
910
from typing import Any, Callable, Optional, Protocol, Sequence, TypeVar, Union
@@ -57,8 +58,15 @@ def __call__(self, data: Union[list[str], str], rhs: Union[list[str], str]):
5758
"""Callback for :class:`QueryList` filtering operators."""
5859

5960

60-
def lookup_exact(data, rhs):
61-
return rhs == data
61+
lookup_exact = operator.eq
62+
"""Exact match. Alias of :func:`operator.eq`.
63+
64+
>>> lookup_exact("cat", "cat")
65+
True
66+
67+
>>> lookup_exact("cat", "dog")
68+
False
69+
"""
6270

6371

6472
def lookup_iexact(data, rhs):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.