()
| 87 | |
| 88 | |
| 89 | def test_default_batch_unbatch_stream(): |
| 90 | api = TestStreamAPIBatched(max_batch_size=4) |
| 91 | api.request_timeout = 30 |
| 92 | api.stream = True |
| 93 | api.pre_setup(spec=None) |
| 94 | inputs = [1, 2, 3, 4] |
| 95 | expected_output = [[0, 0, 0, 0], [1, 2, 3, 4], [2, 4, 6, 8], [3, 6, 9, 12]] |
| 96 | output = api.batch(inputs) |
| 97 | output = api.predict(output) |
| 98 | for out in api.unbatch(output): |
| 99 | expected = expected_output.pop(0) |
| 100 | assert np.all(out == expected), f"Default unbatch should not change input {out} != {expected}" |
| 101 | |
| 102 | |
| 103 | def test_custom_batch_unbatch(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…