Fix attributes sorting based on source code
In Python 3.3, when looking for the source code of line with inspect, sometimes it returnes the class AType that is defined line 155 of test_types.py, which breaks the test. Renaming this AType class to ABCDType, which is a unique name, fix the problem. Change-Id: I54e4a3b5a2df1158dfed0832fe7ab3a9e577ab72
This commit is contained in:
parent
3f8f4ed43f
commit
2f28ce391a
@ -220,15 +220,14 @@ class TestTypes(unittest.TestCase):
|
|||||||
assert isinstance(obj.abytes, types.bytes)
|
assert isinstance(obj.abytes, types.bytes)
|
||||||
|
|
||||||
def test_named_attribute(self):
|
def test_named_attribute(self):
|
||||||
class AType(object):
|
class ABCDType(object):
|
||||||
a_list = types.wsattr([int], name='a.list')
|
a_list = types.wsattr([int], name='a.list')
|
||||||
astr = str
|
astr = str
|
||||||
|
|
||||||
types.register_type(AType)
|
types.register_type(ABCDType)
|
||||||
|
|
||||||
assert len(AType._wsme_attributes) == 2
|
assert len(ABCDType._wsme_attributes) == 2
|
||||||
attrs = AType._wsme_attributes
|
attrs = ABCDType._wsme_attributes
|
||||||
print(attrs)
|
|
||||||
|
|
||||||
assert attrs[0].key == 'a_list', attrs[0].key
|
assert attrs[0].key == 'a_list', attrs[0].key
|
||||||
assert attrs[0].name == 'a.list', attrs[0].name
|
assert attrs[0].name == 'a.list', attrs[0].name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user