Skip to content

Commit 31cd91f

Browse files
bwsawyercp2boston
authored andcommitted
WS-1138 Allow name deduplication threshold to be null as default (#65)
1 parent a76df1c commit 31cd91f

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

rosette/api.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
Python client for the Rosette API.
55
6-
Copyright (c) 2014-2015 Basis Technology Corporation.
6+
Copyright (c) 2014-2017 Basis Technology Corporation.
77
88
Licensed under the Apache License, Version 2.0 (the "License");
99
you may not use this file except in compliance with the License.
@@ -278,7 +278,7 @@ class NameDeduplicationParameters(_DocumentParamSetBase):
278278
"""Parameter object for C{name-deduplication} endpoint.
279279
Required:
280280
C{names} A list of C{name} objects
281-
C{threshold} Threshold to use to restrict cluster size
281+
C{threshold} Threshold to use to restrict cluster size. Can be null to use default value.
282282
"""
283283

284284
def __init__(self):
@@ -287,12 +287,11 @@ def __init__(self):
287287

288288
def validate(self):
289289
"""Internal. Do not use."""
290-
for option in ("names", "threshold"): # required
291-
if self[option] is None:
292-
raise RosetteException(
293-
"missingParameter",
294-
"Required Name De-Duplication parameter, " + option + ", not supplied",
295-
repr(option))
290+
if self["names"] is None: # required
291+
raise RosetteException(
292+
"missingParameter",
293+
"Required Name De-Duplication parameter, names, not supplied",
294+
repr("names"))
296295

297296

298297
class EndpointCaller:

tests/test_rosette_api.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -462,15 +462,6 @@ def test_name_deduplicatation_parameters(api, json_response):
462462

463463
params["names"] = ["John Smith", "Johnathon Smith", "Fred Jones"]
464464

465-
with pytest.raises(RosetteException) as e_rosette:
466-
result = api.name_deduplication(params)
467-
468-
assert e_rosette.value.status == 'missingParameter'
469-
assert e_rosette.value.message == ('Required Name De-Duplication parameter,'
470-
' threshold, not supplied')
471-
472-
params["threshold"] = 0.75
473-
474465
result = api.name_deduplication(params)
475466
assert result["name"] == "Rosette API"
476467

0 commit comments

Comments
 (0)