Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ format: ## Fix python formatting issues where possible
@ruff format . && ruff . --fix --show-fixes

test: ## Run unit test suite
@py.test
@py.test --benchmark-skip

bench: ## Run benchmark test suite
@py.test --benchmark-only

coverage: ## Run coverage and create html report
coverage run -m pytest
coverage run -m pytest --benchmark-skip
coverage html -d coverage_html

build: clean ## builds source and wheel package
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ requires-python = ">=3.8"
[project.optional-dependencies]
dev = [
"pytest ~=7.4.4",
"pytest-benchmark",
"flit ~= 3.9.0",
"ruff ~= 0.1.13",
"coverage ~= 7.4.0",
Expand Down
88 changes: 88 additions & 0 deletions tests/test_benchmark.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import rispy

EXAMPLE_RECORD = """
42.
TY - JOUR
ID - 12345
T1 - The title of the reference
A1 - Marxus, Karlus
A1 - Lindgren, Astrid
A2 - Glattauer, Daniel
Y1 - 2006//
N2 - BACKGROUND: Lorem dammed ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. RESULTS: Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. CONCLUSIONS: Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.
KW - Pippi Langstrumpf
KW - Nordwind
KW - Piraten
KW - Seeräuber
KW - Kinderbuch
KW - Astrid Lindgren
JF - Lorem ipsum dolor sit amet
JA - lorem ipsum dolor sit amet
VL - 6
IS - 3
SP - e0815341
CY - Germany
PB - Dark Factory
SN - 1732-4208
M1 - 1228150341
L2 - http://example2.com
UR - http://example.com/1
UR - http://example.com/2
UR - http://example.com/3
DO - 10.1371/journal.pone.0081534
ER -

""" # noqa


EXAMPLE_RECORD_MULTILINE = """
42.
TY - JOUR
ID - 12345
T1 - The title of the reference
A1 - Marxus, Karlus
A1 - Lindgren, Astrid
A2 - Glattauer, Daniel
Y1 - 2006//
N2 - BACKGROUND: Lorem dammed ipsum dolor sit amet,
consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.
- Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus
- mus. RESULTS: Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
Nulla consequat massa quis enim. CONCLUSIONS: Donec pede justo, fringilla vel, aliquet
nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam
dictum felis eu pede mollis pretium.
KW - Pippi Langstrumpf
KW - Nordwind
KW - Piraten
KW - Seeräuber
KW - Kinderbuch
KW - Astrid Lindgren
JF - Lorem ipsum dolor sit amet
JA - lorem ipsum dolor sit amet
VL - 6
IS - 3
SP - e0815341
CY - Germany
PB - Dark Factory
SN - 1732-4208
M1 - 1228150341
L2 - http://example2.com
UR - http://example.com/1
UR - http://example.com/2
UR - http://example.com/3
DO - 10.1371/journal.pone.0081534
ER -

"""


def test_benchmark_rispy_large(benchmark):
benchmark_dataset = EXAMPLE_RECORD * 10000

benchmark(rispy.loads, benchmark_dataset)


def test_benchmark_rispy_large_multiline(benchmark):
benchmark_dataset = EXAMPLE_RECORD_MULTILINE * 10000

benchmark(rispy.loads, benchmark_dataset)