Coverage for source/model/model_blue_prints/mock_blue_print.py: 86%

7 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-05-30 15:13 +0000

1# model/model_blue_prints/mock_blue_print.py 

2 

3from tensorflow.keras import Model 

4 

5from .base_blue_print import BaseBluePrint 

6 

7class MockBluePrint(BaseBluePrint): 

8 """ 

9 Mock implementation of the BaseBluePrint for testing purposes. 

10 

11 This class provides a simple implementation that returns a pre-configured model 

12 rather than constructing one. It's primarily used in tests to isolate the model 

13 creation logic from other components being tested. 

14 """ 

15 

16 def __init__(self, model_to_be_returned: Model) -> None: 

17 """ 

18 Initialize the mock blueprint with a pre-configured model. 

19 

20 Parameters: 

21 model_to_be_returned (Model): Keras model instance that will be returned 

22 when instantiate_model is called. 

23 """ 

24 

25 self.__model_to_be_returned: Model = model_to_be_returned 

26 

27 def instantiate_model(self, **kwargs) -> Model: 

28 """ 

29 Returns the pre-configured model regardless of input parameters. 

30 

31 This method implements the abstract method from BaseBluePrint but 

32 ignores the input parameters and simply returns the model provided 

33 at initialization. 

34 

35 Parameters: 

36 **kwargs: Variable keyword arguments (ignored). 

37 

38 Returns: 

39 Model: The pre-configured Keras model provided at initialization. 

40 """ 

41 

42 return self.__model_to_be_returned