| 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""" |
||
| 25 | def _suggest(self, text: str, params: dict[str, Any]) -> list[SubjectSuggestion]: |
||
| 26 | score = float(params.get("score", 1.0)) |
||
| 27 | |||
| 28 | # Ensure tests fail if "text" with wrong type ends up here |
||
| 29 | assert isinstance(text, str) |
||
| 30 | |||
| 31 | # Give no hits for no text |
||
| 32 | if len(text) == 0: |
||
| 33 | return [] |
||
| 34 | |||
| 35 | # allow overriding returned subject via uri parameter |
||
| 36 | if "uri" in params: |
||
| 37 | subject_id = self.project.subjects.by_uri(params["uri"]) |
||
| 38 | else: |
||
| 39 | subject_id = self.subject_id |
||
| 40 | |||
| 41 | return [SubjectSuggestion(subject_id=subject_id, score=score)] |
||
| 42 | |||
| 55 |