(self, id, test_input)
| 79 | |
| 80 | @parameterized.expand([TEST_CASE_9, TEST_CASE_10, TEST_CASE_11]) |
| 81 | def test_expression(self, id, test_input): |
| 82 | configer = ConfigExpression(id=id, config=test_input, globals={"monai": monai, "torch": torch}) |
| 83 | var = 100 |
| 84 | ret = configer.evaluate(globals={"var": var, "monai": monai}) # `{"monai": monai}` to verify the warning |
| 85 | if isinstance(ret, Callable): |
| 86 | self.assertTrue(isinstance(ret([torch.tensor(1), torch.tensor(2)]), torch.Tensor)) |
| 87 | else: |
| 88 | # also test the `locals` for regular expressions |
| 89 | ret = configer.evaluate(locals={"var": var}) |
| 90 | self.assertEqual(ret, 200) |
| 91 | |
| 92 | def test_lazy_instantiation(self): |
| 93 | config = {"_target_": "DataLoader", "dataset": Dataset(data=[1, 2]), "batch_size": 2} |
nothing calls this directly
no test coverage detected