Last change
on this file since 149 was 149, checked in by wouter, 3 years ago |
#1 work around nasty bug in python introspection system that caused types to be sometimes classes, sometimes str
|
File size:
619 bytes
|
Rev | Line | |
---|
[134] | 1 | import unittest
|
---|
[141] | 2 | from pyson.JsonTools import getInitArgs
|
---|
[149] | 3 | from abc import ABC
|
---|
[134] | 4 |
|
---|
| 5 | class JsonToolsTest(unittest.TestCase):
|
---|
| 6 | def testGetInitArgs(self):
|
---|
| 7 | class ClassWithInitVars:
|
---|
| 8 | def __init__(self, x:int):
|
---|
| 9 | y=2
|
---|
| 10 |
|
---|
| 11 | self.assertEquals({"x":int}, getInitArgs(ClassWithInitVars))
|
---|
[149] | 12 |
|
---|
| 13 | def testGetInitArgsAbc(self):
|
---|
| 14 | class BaseClass(ABC):
|
---|
| 15 | pass
|
---|
| 16 |
|
---|
| 17 | class ClassWithInitVars2(BaseClass):
|
---|
| 18 | def __init__(self, x:int):
|
---|
| 19 | y=2
|
---|
| 20 |
|
---|
| 21 | self.assertEquals({"x":int}, getInitArgs(ClassWithInitVars2))
|
---|
Note:
See
TracBrowser
for help on using the repository browser.