• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

andgineer / api-db-prototype / 8766121206

20 Apr 2024 03:45PM UTC coverage: 83.956% (-2.9%) from 86.892%
8766121206

push

github

andgineer
upgrade reqs

2 of 2 new or added lines in 2 files covered. (100.0%)

89 existing lines in 23 files now uncovered.

1057 of 1259 relevant lines covered (83.96%)

0.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

46.67
/src/openapi_server/models/base_model.py
1
import pprint
1✔
2

3
import typing
1✔
4

5
from openapi_server import util
1✔
6

7
T = typing.TypeVar('T')
1✔
8

9

10
class Model:
1✔
11
    # openapiTypes: The key is attribute name and the
12
    # value is attribute type.
13
    openapi_types: typing.Dict[str, type] = {}
1✔
14

15
    # attributeMap: The key is attribute name and the
16
    # value is json key in definition.
17
    attribute_map: typing.Dict[str, str] = {}
1✔
18

19
    @classmethod
1✔
20
    def from_dict(cls: typing.Type[T], dikt) -> T:
1✔
21
        """Returns the dict as a model"""
UNCOV
22
        return util.deserialize_model(dikt, cls)
×
23

24
    def to_dict(self):
1✔
25
        """Returns the model properties as a dict
26

27
        :rtype: dict
28
        """
29
        result = {}
×
30

31
        for attr in self.openapi_types:
×
32
            value = getattr(self, attr)
×
33
            if isinstance(value, list):
×
UNCOV
34
                result[attr] = list(map(
×
35
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
36
                    value
37
                ))
38
            elif hasattr(value, "to_dict"):
×
39
                result[attr] = value.to_dict()
×
40
            elif isinstance(value, dict):
×
UNCOV
41
                result[attr] = dict(map(
×
42
                    lambda item: (item[0], item[1].to_dict())
43
                    if hasattr(item[1], "to_dict") else item,
44
                    value.items()
45
                ))
46
            else:
47
                result[attr] = value
×
48

49
        return result
×
50

51
    def to_str(self):
1✔
52
        """Returns the string representation of the model
53

54
        :rtype: str
55
        """
56
        return pprint.pformat(self.to_dict())
×
57

58
    def __repr__(self):
1✔
59
        """For `print` and `pprint`"""
UNCOV
60
        return self.to_str()
×
61

62
    def __eq__(self, other):
1✔
63
        """Returns true if both objects are equal"""
64
        return self.__dict__ == other.__dict__
×
65

66
    def __ne__(self, other):
1✔
67
        """Returns true if both objects are not equal"""
UNCOV
68
        return not self == other
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc