1 from ores
.score_request
import ScoreRequest
4 def test_score_request():
5 sr
= ScoreRequest("foo", [1, 2, 3], ["bar", "baz"], ip
='0.0.0.0')
7 assert sr
.context_name
== "foo"
8 assert sr
.rev_ids
== {1, 2, 3}
9 assert sr
.model_names
== {"bar", "baz"}
10 assert sr
.precache
is False
11 assert sr
.include_features
is False
12 assert sr
.model_info
is None
13 assert sr
.ip
== '0.0.0.0'
16 def test_score_request_serialization():
17 sr
= ScoreRequest("foo", [1, 2, 3], ["bar", "baz"], ip
='0.0.0.0')
19 actual
['model_names'].sort()
20 actual
['rev_ids'].sort()
24 'include_features': False,
25 'injection_caches': {},
28 'model_names': ['bar', 'baz'],
33 def test_score_request_deserialization():
34 sr
= ScoreRequest("foo", [1, 2, 3], ["bar", "baz"], ip
='0.0.0.0')
35 sr_new
= ScoreRequest
.from_json({
37 'include_features': False,
38 'injection_caches': {},
41 'model_names': {'bar', 'baz'},
43 'rev_ids': {1, 2, 3}})
45 assert sr
.to_json() == sr_new
.to_json()