SimonGreenhill: Hmm, wouldn't this be better implemented as a [check](https://github.com/lexibank/pylexibank/blob/master/src/pylexibank/commands/check_lexibank.py) rather than a test? 
LinguList: Nope, the rule is "Smith's", it is never "Smithes". In German, we have
some quirks, but not in English.

SimonGreenhill: Yes, they should raise warnings on buildbot and should be caught.
xrotwang: @SimonGreenhill but if we add this to something run by buildbot for **all** datasets, we will get false positives, e.g. there will be "born-CLDF" datasets at some point - or the CLDF will become the authoritative version, e.g. for WOLD. Then "CLDF dataset derived from ..." does not make sense anymore. So running this from a dataset's `test.py` seems appropriate.
codecov-io: # [Codecov](https://codecov.io/gh/lexibank/pylexibank/pull/214?src=pr&el=h1) Report
> Merging [#214](https://codecov.io/gh/lexibank/pylexibank/pull/214?src=pr&el=desc) into [master](https://codecov.io/gh/lexibank/pylexibank/commit/42ebfccd439b80fcad71f986a0759749f9db532a&el=desc) will **increase** coverage by `0.03%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/lexibank/pylexibank/pull/214/graphs/tree.svg?width=650&height=150&src=pr&token=v0oYsvytpU)](https://codecov.io/gh/lexibank/pylexibank/pull/214?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master     #214      +/-   ##
==========================================
+ Coverage   99.17%   99.20%   +0.03%     
==========================================
  Files          30       32       +2     
  Lines        1693     1884     +191     
==========================================
+ Hits         1679     1869     +190     
- Misses         14       15       +1     
```


| [Impacted Files](https://codecov.io/gh/lexibank/pylexibank/pull/214?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/pylexibank/\_\_init\_\_.py](https://codecov.io/gh/lexibank/pylexibank/pull/214/diff?src=pr&el=tree#diff-c3JjL3B5bGV4aWJhbmsvX19pbml0X18ucHk=) | `100.00% <100.00%> (ø)` | |
| [src/pylexibank/commands/check\_lexibank.py](https://codecov.io/gh/lexibank/pylexibank/pull/214/diff?src=pr&el=tree#diff-c3JjL3B5bGV4aWJhbmsvY29tbWFuZHMvY2hlY2tfbGV4aWJhbmsucHk=) | `83.78% <100.00%> (+14.21%)` | :arrow_up: |
| [src/pylexibank/commands/check\_profile.py](https://codecov.io/gh/lexibank/pylexibank/pull/214/diff?src=pr&el=tree#diff-c3JjL3B5bGV4aWJhbmsvY29tbWFuZHMvY2hlY2tfcHJvZmlsZS5weQ==) | `100.00% <100.00%> (ø)` | |
| [src/pylexibank/commands/format\_profile.py](https://codecov.io/gh/lexibank/pylexibank/pull/214/diff?src=pr&el=tree#diff-c3JjL3B5bGV4aWJhbmsvY29tbWFuZHMvZm9ybWF0X3Byb2ZpbGUucHk=) | `100.00% <100.00%> (ø)` | |
| [src/pylexibank/dataset.py](https://codecov.io/gh/lexibank/pylexibank/pull/214/diff?src=pr&el=tree#diff-c3JjL3B5bGV4aWJhbmsvZGF0YXNldC5weQ==) | `100.00% <100.00%> (ø)` | |
| [src/pylexibank/metadata.py](https://codecov.io/gh/lexibank/pylexibank/pull/214/diff?src=pr&el=tree#diff-c3JjL3B5bGV4aWJhbmsvbWV0YWRhdGEucHk=) | `100.00% <100.00%> (ø)` | |
| [src/pylexibank/models.py](https://codecov.io/gh/lexibank/pylexibank/pull/214/diff?src=pr&el=tree#diff-c3JjL3B5bGV4aWJhbmsvbW9kZWxzLnB5) | `100.00% <100.00%> (ø)` | |
| [src/pylexibank/profile.py](https://codecov.io/gh/lexibank/pylexibank/pull/214/diff?src=pr&el=tree#diff-c3JjL3B5bGV4aWJhbmsvcHJvZmlsZS5weQ==) | `100.00% <100.00%> (ø)` | |
| [src/pylexibank/providers/tob.py](https://codecov.io/gh/lexibank/pylexibank/pull/214/diff?src=pr&el=tree#diff-c3JjL3B5bGV4aWJhbmsvcHJvdmlkZXJzL3RvYi5weQ==) | `100.00% <100.00%> (ø)` | |
| [src/pylexibank/db.py](https://codecov.io/gh/lexibank/pylexibank/pull/214/diff?src=pr&el=tree#diff-c3JjL3B5bGV4aWJhbmsvZGIucHk=) | `99.21% <0.00%> (-0.79%)` | :arrow_down: |
| ... and [2 more](https://codecov.io/gh/lexibank/pylexibank/pull/214/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/lexibank/pylexibank/pull/214?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/lexibank/pylexibank/pull/214?src=pr&el=footer). Last update [6d10128...fe96bf7](https://codecov.io/gh/lexibank/pylexibank/pull/214?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

xrotwang: tbh. I'm a bit reluctant due to the requirement to install pylexibank for tests. This won't be a problem when tests are run from buildbot, because pylexibank will already be present, but I wouldn't want to make the tests run from travis more brittle. So maybe the recommendation would be
- to do the import **in** the test function and exclude the test when run on travis with
```python
@pytest.mark.skipff("TRAVIS" in os.environ and os.environ["TRAVIS"] == "true", reason="Skipping this test on Travis CI.")
```
diff --git a/setup.py b/setup.py
index 8873953..d59cb48 100755
--- a/setup.py
+++ b/setup.py
@@ -28,12 +28,12 @@ setup(
     platforms='any',
     python_requires='>=3.5',
     install_requires=[
+        'attrs>=19.2',
         'segments>=2.1.1',
         'cldfbench[excel]>=1.0',
         'csvw>=1.5.6',
         'clldutils>=2.8.0',
         'pycldf>=1.7.0',
-        'attrs>=18.1.0',
         'pyglottolog>=2.0',
         'pyconcepticon>=2.1.0',
         'pyclts>=2.0',
@@ -49,7 +49,7 @@ setup(
         'dev': ['flake8', 'wheel', 'twine'],
         'test': [
             'mock',
-            'pytest>=3.6',
+            'pytest>=5',
             'pytest-mock',
             'pytest-cov',
             'coverage>=4.2',
diff --git a/src/pylexibank/metadata.py b/src/pylexibank/metadata.py
index 1fdd3df..f79829c 100644
--- a/src/pylexibank/metadata.py
+++ b/src/pylexibank/metadata.py
@@ -1,12 +1,40 @@
+import re
 import pkg_resources
 
 import attr
 from cldfbench.metadata import Metadata
 
-__all__ = ['LexibankMetadata']
+__all__ = ['LexibankMetadata', 'check_standard_title']
 
 version = pkg_resources.get_distribution('pylexibank').version
 
+STANDARD_TITLE_PATTERN = re.compile(
+    r'CLDF dataset derived from\s+'
+    r'(?P<authors>[^"]+)'
+    r'"(?P<title>[^"]+)"\s+from\s+'
+    r'(?P<year>[0-9]{4})'
+)
+
+
+def check_standard_title(title):
+    """
+    Assert a title conforms to the standard format.
+
+    > CLDF dataset derived from AUTHOR's "TITLE" from YEAR
+
+    Usage: In a dataset's `test.py`:
+    ```python
+    import os, pytest
+
+    @pytest.mark.skipif("TRAVIS" in os.environ and os.environ["TRAVIS"] == "true")
+    def test_valid_title(cldf_dataset, cldf_logger):
+        from pylexibank import check_standard_title
+        check_standard_title(cldf_dataset.metadata_dict['dc:title'])
+    ```
+    """
+    match = STANDARD_TITLE_PATTERN.fullmatch(title)
+    assert match and match.group('authors').strip().endswith(("'s", "s'"))
+
 
 @attr.s
 class LexibankMetadata(Metadata):

Add check that metadata['title'] follows recommended form?
Do we want to check if the title follows the [recommended form](https://github.com/lexibank/lexibank/blob/master/CONTRIBUTING.md#titles-for-lexibank-datasets): 

```
  "title": "CLDF dataset derived from AUTHOR's \"SHORTTITLE\" from YEAR."
```

(even superficially like `assert title.startswith("CLDF dataset")`)
diff --git a/tests/test_metadata.py b/tests/test_metadata.py
index 80ee591..97b390e 100644
--- a/tests/test_metadata.py
+++ b/tests/test_metadata.py
@@ -1,3 +1,5 @@
+import pytest
+
 from pylexibank.metadata import *
 
 
@@ -5,3 +7,24 @@ def test_conceptlist():
     md = LexibankMetadata(conceptlist='Swadesh-1964-100', related='abc')
     assert isinstance(md.conceptlist, list)
     assert 'concepticon.clld.org' in md.markdown()
+
+
+STANDARD_TITLE = """CLDF dataset derived from A et al.'s "Paper" from 1934"""
+
+
+@pytest.mark.parametrize('title', [
+    "",
+    STANDARD_TITLE.replace('CLDF', 'cldf'),
+    STANDARD_TITLE.replace("et al.'s", 'et al.’s'),
+    STANDARD_TITLE.replace('"', "'"),
+    STANDARD_TITLE.replace('1934', '34'),
+])
+def test_invalid_standard_title(title):
+    with pytest.raises(AssertionError):
+        check_standard_title(title)
+
+
+def test_valid_standard_title():
+    assert check_standard_title(STANDARD_TITLE) is None
+    assert check_standard_title(STANDARD_TITLE.replace(" et al.'s", "brams'")) is None
+

pip install -e .[dev,test]
parse_log_pytest
requirements.txt
pytest pytest-mock pytest-cov
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
appdirs==1.4.4
attrs==25.3.0
babel==2.17.0
backports.tarfile==1.2.0
beautifulsoup4==4.13.3
bibtexparser==2.0.0b8
bs4==0.0.2
cdstarcat==1.5.0
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
cldfbench==1.14.1
cldfcatalog==1.6.0
cldfzenodo==2.1.2
clldutils==3.24.2
colorama==0.4.6
colorlog==6.9.0
commonnexus==1.9.2
coverage==7.8.0
cryptography==44.0.2
csvw==3.5.1
docopt==0.6.2
docutils==0.21.2
et_xmlfile==2.0.0
exceptiongroup==1.2.2
flake8==7.2.0
gitdb==4.0.12
GitPython==3.1.44
greenlet==3.1.1
id==1.5.0
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
isodate==0.7.2
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jeepney==0.9.0
jmespath==1.0.1
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
keyring==25.6.0
language-tags==1.2.0
latexcodec==3.0.0
linglit==1.7.1
lingpy==2.6.13
lxml==5.3.1
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mccabe==0.7.0
mdurl==0.1.2
mock==5.2.0
more-itertools==10.6.0
nameparser==1.1.3
networkx==3.2.1
newick==1.10.0
nh3==0.2.21
numpy==2.0.2
openpyxl==3.1.5
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
pybtex==0.24.0
pycdstar==1.1.0
pycldf==1.41.0
pyclts==3.2.0
pycodestyle==2.13.0
pyconcepticon==3.1.0
pycountry==24.6.1
pycparser==2.22
pyflakes==3.3.2
pyglottolog==3.14.0
Pygments==2.19.1
pyigt==2.2.0
pylatexenc==2.10
-e git+https://github.com/lexibank/pylexibank.git@6d10128138acc01844793e247248eca83eedb4d6#egg=pylexibank
pyparsing==3.2.3
pytest==8.3.5
pytest-cov==6.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
python-frontmatter==1.1.0
PyYAML==6.0.2
RapidFuzz==3.12.2
rdflib==7.1.4
readme_renderer==44.0
referencing==0.36.2
regex==2024.11.6
requests==2.32.3
requests-toolbelt==1.0.0
rfc3986==1.5.0
rich==14.0.0
rpds-py==0.24.0
SecretStorage==3.3.3
segments==2.3.0
six==1.17.0
smmap==5.0.2
soupsieve==2.6
SQLAlchemy==1.4.54
tabulate==0.9.0
termcolor==3.0.0
TexSoup==0.3.1
thefuzz==0.22.1
tomli==2.2.1
tqdm==4.67.1
twine==6.1.0
typing_extensions==4.13.0
Unidecode==1.3.8
uritemplate==4.1.1
urllib3==2.3.0
Whoosh==2.7.4
xlrd==2.0.1
zenodoclient==0.5.1
zipp==3.21.0

name: pylexibank
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - appdirs==1.4.4
      - attrs==25.3.0
      - babel==2.17.0
      - backports-tarfile==1.2.0
      - beautifulsoup4==4.13.3
      - bibtexparser==2.0.0b8
      - bs4==0.0.2
      - cdstarcat==1.5.0
      - certifi==2025.1.31
      - cffi==1.17.1
      - charset-normalizer==3.4.1
      - cldfbench==1.14.1
      - cldfcatalog==1.6.0
      - cldfzenodo==2.1.2
      - clldutils==3.24.2
      - colorama==0.4.6
      - colorlog==6.9.0
      - commonnexus==1.9.2
      - coverage==7.8.0
      - cryptography==44.0.2
      - csvw==3.5.1
      - docopt==0.6.2
      - docutils==0.21.2
      - et-xmlfile==2.0.0
      - exceptiongroup==1.2.2
      - flake8==7.2.0
      - gitdb==4.0.12
      - gitpython==3.1.44
      - greenlet==3.1.1
      - id==1.5.0
      - idna==3.10
      - importlib-metadata==8.6.1
      - iniconfig==2.1.0
      - isodate==0.7.2
      - jaraco-classes==3.4.0
      - jaraco-context==6.0.1
      - jaraco-functools==4.1.0
      - jeepney==0.9.0
      - jmespath==1.0.1
      - jsonschema==4.23.0
      - jsonschema-specifications==2024.10.1
      - keyring==25.6.0
      - language-tags==1.2.0
      - latexcodec==3.0.0
      - linglit==1.7.1
      - lingpy==2.6.13
      - lxml==5.3.1
      - markdown==3.7
      - markdown-it-py==3.0.0
      - markupsafe==3.0.2
      - mccabe==0.7.0
      - mdurl==0.1.2
      - mock==5.2.0
      - more-itertools==10.6.0
      - nameparser==1.1.3
      - networkx==3.2.1
      - newick==1.10.0
      - nh3==0.2.21
      - numpy==2.0.2
      - openpyxl==3.1.5
      - packaging==24.2
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - pybtex==0.24.0
      - pycdstar==1.1.0
      - pycldf==1.41.0
      - pyclts==3.2.0
      - pycodestyle==2.13.0
      - pyconcepticon==3.1.0
      - pycountry==24.6.1
      - pycparser==2.22
      - pyflakes==3.3.2
      - pyglottolog==3.14.0
      - pygments==2.19.1
      - pyigt==2.2.0
      - pylatexenc==2.10
      - pyparsing==3.2.3
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - python-dateutil==2.9.0.post0
      - python-frontmatter==1.1.0
      - pyyaml==6.0.2
      - rapidfuzz==3.12.2
      - rdflib==7.1.4
      - readme-renderer==44.0
      - referencing==0.36.2
      - regex==2024.11.6
      - requests==2.32.3
      - requests-toolbelt==1.0.0
      - rfc3986==1.5.0
      - rich==14.0.0
      - rpds-py==0.24.0
      - secretstorage==3.3.3
      - segments==2.3.0
      - six==1.17.0
      - smmap==5.0.2
      - soupsieve==2.6
      - sqlalchemy==1.4.54
      - tabulate==0.9.0
      - termcolor==3.0.0
      - texsoup==0.3.1
      - thefuzz==0.22.1
      - tomli==2.2.1
      - tqdm==4.67.1
      - twine==6.1.0
      - typing-extensions==4.13.0
      - unidecode==1.3.8
      - uritemplate==4.1.1
      - urllib3==2.3.0
      - whoosh==2.7.4
      - xlrd==2.0.1
      - zenodoclient==0.5.1
      - zipp==3.21.0
prefix: /opt/conda/envs/pylexibank

tests/test_metadata.py::test_invalid_standard_title[] tests/test_metadata.py::test_invalid_standard_title[cldf tests/test_metadata.py::test_invalid_standard_title[CLDF tests/test_metadata.py::test_valid_standard_title
tests/test_metadata.py::test_conceptlist
setup.py src/pylexibank/metadata.py
setup.py src/pylexibank/metadata.py