diff --git a/dephell_changelogs/_parser.py b/dephell_changelogs/_parser.py index e726af2..7e200af 100644 --- a/dephell_changelogs/_parser.py +++ b/dephell_changelogs/_parser.py @@ -8,7 +8,7 @@ rex_version = re.compile(r'[0-9]+\.[0-9]+\.[0-9]+') -_VERSION_REX = r'(?:[vV]\.?)?([0-9\.]+)' +_VERSION_REX = r'(?:[vV]\.?)?([0-9\.]+(?:[ab][0-9])?)' rexes = ( # `Version 1.2.3 ...` re.compile(r'(?:Version|Release) {}.*'.format(_VERSION_REX)), @@ -16,8 +16,8 @@ re.compile(r'(?:\#|\=)+ {}.*'.format(_VERSION_REX)), # `v.2.3.4` re.compile(_VERSION_REX), - # `v.2.3.4 (2019-01-02)` - re.compile(r'{} \([0-9-]+\)'.format(_VERSION_REX)), + # `v.2.3.4 (2019-01-02)` and `project-name v.2.3.4 (2019-01-02)` + re.compile(r'(?:[A-Za-z-]+ )?{} \([0-9-]+\)'.format(_VERSION_REX)), # `* 1.2.3` re.compile(r'[\+\-\*] {}'.format(_VERSION_REX)), # `...:release:`1.11.0 <2018-03-19>`...` diff --git a/tests/test_parser.py b/tests/test_parser.py index 653e527..d0c249a 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -18,6 +18,8 @@ ('2.2.2 (2019-12-26)', '2.2.2'), # dynaconf ('20.0.1 (2020-01-21)', '20.0.1'), # pip ('0.2', '0.2'), # pip + ('1.0.0b3', '1.0.0b3'), # pytest + ('pytest 5.3.3 (2020-01-16)', '5.3.3'), # pytest ('* 2.2.1', '2.2.1'), # pyyaml ('- v0.5.1', '0.5.1'), # websocket-client