Skip to content

FIX: Assert at least one matched User-Agent, not exactly one#332

Merged
oleksandrlazarenko-pi merged 1 commit into
mainfrom
fix/362-useragents-count
Jul 23, 2026
Merged

FIX: Assert at least one matched User-Agent, not exactly one#332
oleksandrlazarenko-pi merged 1 commit into
mainfrom
fix/362-useragents-count

Conversation

@oleksandrlazarenko-pi

Copy link
Copy Markdown
Contributor

Relates to #TASK

Updates the on-premise device detection test for the unified detection result
shape introduced in 51Degrees/device-detection-cxx#362 (merged in
51Degrees/device-detection-cxx#385).

test_matched_user_agents asserted that a single User-Agent produces exactly
one matched User-Agent. #362 removed the fast path that coupled result shape to
evidence cardinality, so detection now produces one result - and so one matched
User-Agent - per component the engine populates. A single User-Agent yields
several rather than one.

Change

assertEqual(len(...), 1) becomes assertGreaterEqual(len(...), 1). The exact
number depends on which components the data file makes available, so pinning a
literal would be brittle across data file revisions.

The new assertion holds under both the old shape (1) and the new one, so this
can land ahead of the submodule bump rather than having to ship with it.

Sequencing

The pending submodule PR #331 bumps cxx from 9027aa8 to c7b2822, which is
where the new shape arrives. Merging this first means #331 goes green on its
own; merging #331 first would turn the nightly red until this lands.

Verification

Test-only change; syntax checked with python -m py_compile. Not executed
locally - the on-premise package needs a compiled SWIG extension that was not
built in the environment used. CI is the check.

Related

The same assertion is being corrected in device-detection-java,
device-detection-dotnet, device-detection-node and device-detection-go.
device-detection-php is unaffected - it asserts no result counts.

@oleksandrlazarenko-pi
oleksandrlazarenko-pi merged commit a24e778 into main Jul 23, 2026
20 checks passed
@oleksandrlazarenko-pi
oleksandrlazarenko-pi deleted the fix/362-useragents-count branch July 23, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants