Conditions | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | """Dummy backend for testing basic interaction of projects and backends""" |
||
24 | def _suggest(self, text: str, params: dict[str, Any]) -> list[SubjectSuggestion]: |
||
25 | score = float(params.get("score", 1.0)) |
||
26 | |||
27 | # Ensure tests fail if "text" with wrong type ends up here |
||
28 | assert isinstance(text, str) |
||
29 | |||
30 | # Give no hits for no text |
||
31 | if len(text) == 0: |
||
32 | return [] |
||
33 | |||
34 | # allow overriding returned subject via uri parameter |
||
35 | if "uri" in params: |
||
36 | subject_id = self.project.subjects.by_uri(params["uri"]) |
||
37 | else: |
||
38 | subject_id = self.subject_id |
||
39 | |||
40 | return [SubjectSuggestion(subject_id=subject_id, score=score)] |
||
41 | |||
54 |