| 24 | |
| 25 | |
| 26 | class TestGetScalarInputs: |
| 27 | def test_no_scalars_returns_empty(self): |
| 28 | wkl = _wkl(a={"type": "random"}) |
| 29 | assert wkl.get_scalar_inputs() == {} |
| 30 | |
| 31 | def test_single_int_scalar(self): |
| 32 | wkl = _wkl(x={"type": "scalar", "value": 42}) |
| 33 | assert wkl.get_scalar_inputs() == {"x": 42} |
| 34 | |
| 35 | def test_single_float_scalar(self): |
| 36 | wkl = _wkl(scale={"type": "scalar", "value": 0.5}) |
| 37 | assert wkl.get_scalar_inputs() == {"scale": 0.5} |
| 38 | |
| 39 | def test_multiple_scalars(self): |
| 40 | wkl = _wkl( |
| 41 | a={"type": "scalar", "value": 1}, |
| 42 | b={"type": "scalar", "value": 2}, |
| 43 | ) |
| 44 | assert wkl.get_scalar_inputs() == {"a": 1, "b": 2} |
| 45 | |
| 46 | def test_mixed_inputs_returns_only_scalars(self): |
| 47 | wkl = _wkl( |
| 48 | a={"type": "random"}, |
| 49 | b={"type": "scalar", "value": 7}, |
| 50 | c={"type": "safetensors", "path": "f.safetensors", "tensor_key": "k"}, |
| 51 | ) |
| 52 | assert wkl.get_scalar_inputs() == {"b": 7} |
| 53 | |
| 54 | def test_all_custom_returns_empty(self): |
| 55 | wkl = _wkl(a={"type": "custom"}, b={"type": "custom"}) |
| 56 | assert wkl.get_scalar_inputs() == {} |
nothing calls this directly
no outgoing calls
no test coverage detected