This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Select best imperative by longest prefix match
- Loading branch information
Showing
4 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Unit test for pydocstyle utils. | ||
Use tox or py.test to run the test suite. | ||
""" | ||
from pydocstyle import utils | ||
|
||
|
||
__all__ = () | ||
|
||
|
||
def test_common_prefix(): | ||
"""We can find the common prefix of two strings.""" | ||
assert utils.common_prefix_length('abcd', 'abce') == 3 | ||
|
||
|
||
def test_no_common_prefix(): | ||
"""If two strings have no common prefix, return the empty string.""" | ||
assert utils.common_prefix_length('abcd', 'cdef') == 0 | ||
|
||
|
||
def test_differ_length(): | ||
"""We can find a common prefix of two strings differing in length.""" | ||
assert utils.common_prefix_length('abcd', 'ab') == 2 |