Last change
on this file since 1269 was 995, checked in by wouter, 5 months ago |
#339 narrowed issue with unit tests that specifically show this issue.
|
File size:
1.1 KB
|
Line | |
---|
1 | import unittest
|
---|
2 | import random
|
---|
3 | from unitpy.GeneralTests import GeneralTests
|
---|
4 | from typing import List
|
---|
5 | from pickle import TRUE
|
---|
6 | from unitpy.Parameters import Parameters, getParameters
|
---|
7 |
|
---|
8 |
|
---|
9 | class Clazz1:
|
---|
10 | '''
|
---|
11 | Bugged, it always returns the same hashcode.
|
---|
12 | '''
|
---|
13 | def __init__(self, v:str):
|
---|
14 | self.value = v
|
---|
15 |
|
---|
16 | def __repr__(self):
|
---|
17 | return str(self.value) + " " + str(random.randint(1,100))
|
---|
18 |
|
---|
19 | def __hash__(self):
|
---|
20 | return hash(self.value)
|
---|
21 |
|
---|
22 | def __eq__(self, other):
|
---|
23 | return isinstance(other, self.__class__) and \
|
---|
24 | self.value == other.value
|
---|
25 |
|
---|
26 | class Clazz2(Clazz1):
|
---|
27 | @staticmethod
|
---|
28 | @Parameters()
|
---|
29 | def closeit():
|
---|
30 | return [["ok"]]
|
---|
31 |
|
---|
32 |
|
---|
33 | class Clazz3(Clazz1):
|
---|
34 | @Parameters()
|
---|
35 | @staticmethod
|
---|
36 | def closeit():
|
---|
37 | return [["ok"]]
|
---|
38 |
|
---|
39 | class ParametersTest(unittest.TestCase):
|
---|
40 | def test1(self):
|
---|
41 | self.assertEqual(None, getParameters(Clazz1))
|
---|
42 |
|
---|
43 | def test2(self):
|
---|
44 | self.assertEqual( Clazz2.closeit, getParameters(Clazz2))
|
---|
45 |
|
---|
46 | def test3(self):
|
---|
47 | self.assertEqual( Clazz3.closeit, getParameters(Clazz3))
|
---|
Note:
See
TracBrowser
for help on using the repository browser.