Skip to content

Commit 8a2c8a4

Browse files
committed
tests(lookup_exact): Use operator, add doctest
1 parent 05468cf commit 8a2c8a4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

libvcs/_internal/query_list.py

Lines 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)