File: test_model_object.py

package info (click to toggle)
python-marathon 0.13.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 460 kB
  • sloc: python: 1,969; makefile: 185; sh: 58
file content (38 lines) | stat: -rw-r--r-- 1,099 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from marathon.models.base import MarathonObject
from marathon.models.base import MarathonResource
import unittest


class MarathonObjectTest(unittest.TestCase):

    def test_hashable(self):
        """
        Regression test for issue #203

        MarathonObject defined __eq__ but not __hash__, meaning that in
        in Python2.7 MarathonObjects are hashable, but in Python3 they're not,

        This test ensures that we are hashable in all versions of python
        """
        obj = MarathonObject()
        collection = {}
        collection[obj] = True
        assert collection[obj]


class MarathonResourceHashable(unittest.TestCase):

    def test_hashable(self):
        """
        Regression test for issue #203

        MarathonResource defined __eq__ but not __hash__, meaning that in
        in Python2.7 MarathonResources are hashable, but in Python3 they're
        not

        This test ensures that we are hashable in all versions of python
        """
        obj = MarathonResource()
        collection = {}
        collection[obj] = True
        assert collection[obj]