Path 1: 6 calls (0.75)

module (5) test_config_from_class..Test def (1)

1def from_object(self, obj: object | str) -> None:
2        """Updates the values from the given object.  An object can be of one
3        of the following two types:
4
5        -   a string: in this case the object with that name will be imported
6        -   an actual object reference: that object is used directly
7
8        Objects are usually either modules or classes. :meth:`from_object`
9        loads only the uppercase attributes of the module/class. A ``dict``
10        object will not work with :meth:`from_object` because the keys of a
11        ``dict`` are not attributes of the ``dict`` class.
12
13        Example of module-based configuration::
14
15            app.config.from_object('yourapplication.default_config')
16            from yourapplication import default_config
17            app.config.from_object(default_config)
18
19        Nothing is done to the object before loading. If the object is a
20        class and has ``@property`` attributes, it needs to be
21        instantiated before being passed to this method.
22
23        You should not use this function to load the actual configuration but
24        rather configuration defaults.  The actual config should be loaded
25        with :meth:`from_pyfile` and ideally from a location not within the
26        package because the package might be installed system wide.
27
28        See :ref:`config-dev-prod` for an example of class-based configuration
29        using :meth:`from_object`.
30
31        :param obj: an import name or object
32        """
33        if isinstance(obj, str):
34            obj = import_string(obj)
35        for key in dir(obj):
36            if key.isupper():
37                self[key] = getattr(obj, key)
            

Path 2: 2 calls (0.25)

'test_config' (2)

1def from_object(self, obj: object | str) -> None:
2        """Updates the values from the given object.  An object can be of one
3        of the following two types:
4
5        -   a string: in this case the object with that name will be imported
6        -   an actual object reference: that object is used directly
7
8        Objects are usually either modules or classes. :meth:`from_object`
9        loads only the uppercase attributes of the module/class. A ``dict``
10        object will not work with :meth:`from_object` because the keys of a
11        ``dict`` are not attributes of the ``dict`` class.
12
13        Example of module-based configuration::
14
15            app.config.from_object('yourapplication.default_config')
16            from yourapplication import default_config
17            app.config.from_object(default_config)
18
19        Nothing is done to the object before loading. If the object is a
20        class and has ``@property`` attributes, it needs to be
21        instantiated before being passed to this method.
22
23        You should not use this function to load the actual configuration but
24        rather configuration defaults.  The actual config should be loaded
25        with :meth:`from_pyfile` and ideally from a location not within the
26        package because the package might be installed system wide.
27
28        See :ref:`config-dev-prod` for an example of class-based configuration
29        using :meth:`from_object`.
30
31        :param obj: an import name or object
32        """
33        if isinstance(obj, str):
34            obj = import_string(obj)
35        for key in dir(obj):
36            if key.isupper():
37                self[key] = getattr(obj, key)