cdxcore 0.1.10__py3-none-any.whl → 0.1.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cdxcore might be problematic. Click here for more details.
- cdxcore/__init__.py +1 -1
- cdxcore/crman.py +4 -1
- cdxcore/deferred.py +752 -0
- cdxcore/err.py +10 -5
- cdxcore/jcpool.py +337 -106
- cdxcore/subdir.py +1 -1
- cdxcore/util.py +72 -1
- cdxcore/verbose.py +15 -1
- {cdxcore-0.1.10.dist-info → cdxcore-0.1.13.dist-info}/METADATA +1 -1
- cdxcore-0.1.13.dist-info/RECORD +37 -0
- tests/test_config.py +1 -11
- tests/test_crman.py +2 -13
- tests/test_deferred.py +277 -0
- tests/test_err.py +2 -10
- tests/test_jcpool.py +185 -0
- tests/test_pretty.py +2 -12
- tests/test_subdir.py +1 -9
- tests/test_uniquehash.py +1 -9
- tests/test_util.py +100 -10
- tests/test_verbose.py +1 -10
- tests/test_version.py +1 -9
- cdxcore-0.1.10.dist-info/RECORD +0 -35
- tmp/deferred.py +0 -220
- {tmp → cdxcore}/dynaplot.py +0 -0
- {cdxcore-0.1.10.dist-info → cdxcore-0.1.13.dist-info}/WHEEL +0 -0
- {cdxcore-0.1.10.dist-info → cdxcore-0.1.13.dist-info}/licenses/LICENSE +0 -0
- {cdxcore-0.1.10.dist-info → cdxcore-0.1.13.dist-info}/top_level.txt +0 -0
tests/test_jcpool.py
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created on Tue Apr 14 21:24:52 2020
|
|
4
|
+
@author: hansb
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import unittest as unittest
|
|
8
|
+
|
|
9
|
+
def import_local():
|
|
10
|
+
"""
|
|
11
|
+
In order to be able to run our tests manually from the 'tests' directory
|
|
12
|
+
we force import from the local package.
|
|
13
|
+
"""
|
|
14
|
+
me = "cdxcore"
|
|
15
|
+
import os
|
|
16
|
+
import sys
|
|
17
|
+
cwd = os.getcwd()
|
|
18
|
+
if cwd[-len(me):] == me:
|
|
19
|
+
return
|
|
20
|
+
assert cwd[-5:] == "tests",("Expected current working directory to be in a 'tests' directory", cwd[-5:], "from", cwd)
|
|
21
|
+
assert cwd[-6] in ['/', '\\'],("Expected current working directory 'tests' to be lead by a '\\' or '/'", cwd[-6:], "from", cwd)
|
|
22
|
+
sys.path.insert( 0, cwd[:-6] )
|
|
23
|
+
import_local()
|
|
24
|
+
|
|
25
|
+
from cdxcore.jcpool import JCPool, Context
|
|
26
|
+
import numpy as np
|
|
27
|
+
|
|
28
|
+
class Test(unittest.TestCase):
|
|
29
|
+
|
|
30
|
+
def test_mp(self):
|
|
31
|
+
|
|
32
|
+
self.maxDiff = None
|
|
33
|
+
|
|
34
|
+
pool = JCPool(2, threading=False)
|
|
35
|
+
|
|
36
|
+
class Channel(object):
|
|
37
|
+
""" utility to collect all traced messages """
|
|
38
|
+
def __init__(self):
|
|
39
|
+
self.messages = []
|
|
40
|
+
def __call__(self, msg, flush):
|
|
41
|
+
self.messages.append( msg )
|
|
42
|
+
|
|
43
|
+
def f( ticker, tdata, verbose : Context ):
|
|
44
|
+
# some made up results
|
|
45
|
+
q = np.quantile( tdata, 0.35, axis=0 )
|
|
46
|
+
tx = q[0]
|
|
47
|
+
ty = q[1]
|
|
48
|
+
# not in a unittest --> time.sleep( np.exp(tdata[0,0]) )
|
|
49
|
+
verbose.write(f"Result for {ticker}: {tx:.2f}, {ty:.2f}")
|
|
50
|
+
return tx, ty
|
|
51
|
+
|
|
52
|
+
np.random.seed(1231)
|
|
53
|
+
tickerdata =\
|
|
54
|
+
{ 'SPY': np.random.normal(size=(1000,2)),
|
|
55
|
+
'GLD': np.random.normal(size=(1000,2)),
|
|
56
|
+
'BTC': np.random.normal(size=(1000,2))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# iterator mode
|
|
60
|
+
channel = Channel()
|
|
61
|
+
verbose_main = Context("all", channel=channel)
|
|
62
|
+
|
|
63
|
+
verbose_main.write("Launching analysis")
|
|
64
|
+
with pool.context( verbose_main ) as verbose:
|
|
65
|
+
for ticker, tx, ty in pool.parallel(
|
|
66
|
+
{ ticker: pool.delayed(f)( ticker=ticker, tdata=tdata, verbose=verbose(2) )
|
|
67
|
+
for ticker, tdata in tickerdata.items() } ):
|
|
68
|
+
verbose.report(1,f"Returned {ticker} {tx:.2f}, {ty:.2f}")
|
|
69
|
+
verbose_main.write("Analysis done")
|
|
70
|
+
|
|
71
|
+
l = sorted( channel.messages )
|
|
72
|
+
self.assertEqual( str(l), r"['00: Analysis done\n', '00: Launching analysis\n', '01: Returned BTC -0.38, -0.42\n', '01: Returned GLD -0.47, -0.42\n', '01: Returned SPY -0.42, -0.41\n', '02: Result for BTC: -0.38, -0.42\n', '02: Result for GLD: -0.47, -0.42\n', '02: Result for SPY: -0.42, -0.41\n']")
|
|
73
|
+
|
|
74
|
+
# dict mode
|
|
75
|
+
channel = Channel()
|
|
76
|
+
verbose_main = Context("all", channel=channel)
|
|
77
|
+
|
|
78
|
+
verbose_main.write("Launching analysis")
|
|
79
|
+
with pool.context( verbose_main ) as verbose:
|
|
80
|
+
l = pool.parallel_to_dict(
|
|
81
|
+
{ ticker: pool.delayed(f)( ticker=ticker, tdata=tdata, verbose=verbose(2) )
|
|
82
|
+
for ticker, tdata in tickerdata.items() } )
|
|
83
|
+
verbose_main.write("Analysis done")
|
|
84
|
+
self.assertEqual( type(l), dict )
|
|
85
|
+
|
|
86
|
+
l = sorted( channel.messages )
|
|
87
|
+
self.assertEqual( str(l), r"['00: Analysis done\n', '00: Launching analysis\n', '02: Result for BTC: -0.38, -0.42\n', '02: Result for GLD: -0.47, -0.42\n', '02: Result for SPY: -0.42, -0.41\n']")
|
|
88
|
+
|
|
89
|
+
# list mode
|
|
90
|
+
channel = Channel()
|
|
91
|
+
verbose_main = Context("all", channel=channel)
|
|
92
|
+
|
|
93
|
+
verbose_main.write("Launching analysis")
|
|
94
|
+
with pool.context( verbose_main ) as verbose:
|
|
95
|
+
l = pool.parallel_to_list(
|
|
96
|
+
pool.delayed(f)( ticker=ticker, tdata=tdata, verbose=verbose(2) )
|
|
97
|
+
for ticker, tdata in tickerdata.items() )
|
|
98
|
+
verbose_main.write("Analysis done")
|
|
99
|
+
self.assertEqual( type(l), list )
|
|
100
|
+
|
|
101
|
+
l = sorted( channel.messages )
|
|
102
|
+
self.assertEqual( str(l), r"['00: Analysis done\n', '00: Launching analysis\n', '02: Result for BTC: -0.38, -0.42\n', '02: Result for GLD: -0.47, -0.42\n', '02: Result for SPY: -0.42, -0.41\n']")
|
|
103
|
+
|
|
104
|
+
def test_mt(self):
|
|
105
|
+
|
|
106
|
+
self.maxDiff = None
|
|
107
|
+
|
|
108
|
+
pool = JCPool(2, threading=True)
|
|
109
|
+
|
|
110
|
+
class Channel(object):
|
|
111
|
+
""" utility to collect all traced messages """
|
|
112
|
+
def __init__(self):
|
|
113
|
+
self.messages = []
|
|
114
|
+
def __call__(self, msg, flush):
|
|
115
|
+
self.messages.append( msg )
|
|
116
|
+
|
|
117
|
+
def f( ticker, tdata, verbose : Context ):
|
|
118
|
+
# some made up results
|
|
119
|
+
q = np.quantile( tdata, 0.35, axis=0 )
|
|
120
|
+
tx = q[0]
|
|
121
|
+
ty = q[1]
|
|
122
|
+
# not in a unittest --> time.sleep( np.exp(tdata[0,0]) )
|
|
123
|
+
verbose.write(f"Result for {ticker}: {tx:.2f}, {ty:.2f}")
|
|
124
|
+
return tx, ty
|
|
125
|
+
|
|
126
|
+
np.random.seed(1231)
|
|
127
|
+
tickerdata =\
|
|
128
|
+
{ 'SPY': np.random.normal(size=(1000,2)),
|
|
129
|
+
'GLD': np.random.normal(size=(1000,2)),
|
|
130
|
+
'BTC': np.random.normal(size=(1000,2))
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
# iterator mode
|
|
134
|
+
channel = Channel()
|
|
135
|
+
verbose_main = Context("all", channel=channel)
|
|
136
|
+
|
|
137
|
+
verbose_main.write("Launching analysis")
|
|
138
|
+
with pool.context( verbose_main ) as verbose:
|
|
139
|
+
for ticker, tx, ty in pool.parallel(
|
|
140
|
+
{ ticker: pool.delayed(f)( ticker=ticker, tdata=tdata, verbose=verbose(2) )
|
|
141
|
+
for ticker, tdata in tickerdata.items() } ):
|
|
142
|
+
verbose.report(1,f"Returned {ticker} {tx:.2f}, {ty:.2f}")
|
|
143
|
+
verbose_main.write("Analysis done")
|
|
144
|
+
|
|
145
|
+
l = sorted( channel.messages )
|
|
146
|
+
self.assertEqual( str(l), r"['00: Analysis done\n', '00: Launching analysis\n', '01: Returned BTC -0.38, -0.42\n', '01: Returned GLD -0.47, -0.42\n', '01: Returned SPY -0.42, -0.41\n', '02: Result for BTC: -0.38, -0.42\n', '02: Result for GLD: -0.47, -0.42\n', '02: Result for SPY: -0.42, -0.41\n']")
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# dict mode
|
|
151
|
+
channel = Channel()
|
|
152
|
+
verbose_main = Context("all", channel=channel)
|
|
153
|
+
|
|
154
|
+
verbose_main.write("Launching analysis")
|
|
155
|
+
with pool.context( verbose_main ) as verbose:
|
|
156
|
+
l = pool.parallel_to_dict(
|
|
157
|
+
{ ticker: pool.delayed(f)( ticker=ticker, tdata=tdata, verbose=verbose(2) )
|
|
158
|
+
for ticker, tdata in tickerdata.items() } )
|
|
159
|
+
verbose_main.write("Analysis done")
|
|
160
|
+
self.assertEqual( type(l), dict )
|
|
161
|
+
|
|
162
|
+
l = sorted( channel.messages )
|
|
163
|
+
self.assertEqual( str(l), r"['00: Analysis done\n', '00: Launching analysis\n', '02: Result for BTC: -0.38, -0.42\n', '02: Result for GLD: -0.47, -0.42\n', '02: Result for SPY: -0.42, -0.41\n']")
|
|
164
|
+
|
|
165
|
+
# list mode
|
|
166
|
+
channel = Channel()
|
|
167
|
+
verbose_main = Context("all", channel=channel)
|
|
168
|
+
|
|
169
|
+
verbose_main.write("Launching analysis")
|
|
170
|
+
with pool.context( verbose_main ) as verbose:
|
|
171
|
+
l = pool.parallel_to_list(
|
|
172
|
+
pool.delayed(f)( ticker=ticker, tdata=tdata, verbose=verbose(2) )
|
|
173
|
+
for ticker, tdata in tickerdata.items() )
|
|
174
|
+
verbose_main.write("Analysis done")
|
|
175
|
+
self.assertEqual( type(l), list )
|
|
176
|
+
|
|
177
|
+
l = sorted( channel.messages )
|
|
178
|
+
self.assertEqual( str(l), r"['00: Analysis done\n', '00: Launching analysis\n', '02: Result for BTC: -0.38, -0.42\n', '02: Result for GLD: -0.47, -0.42\n', '02: Result for SPY: -0.42, -0.41\n']")
|
|
179
|
+
|
|
180
|
+
if __name__ == '__main__':
|
|
181
|
+
unittest.main()
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
tests/test_pretty.py
CHANGED
|
@@ -18,7 +18,6 @@ def import_local():
|
|
|
18
18
|
"""
|
|
19
19
|
In order to be able to run our tests manually from the 'tests' directory
|
|
20
20
|
we force import from the local package.
|
|
21
|
-
We also force reloading all modules to make sure we are not running old code.
|
|
22
21
|
"""
|
|
23
22
|
me = "cdxcore"
|
|
24
23
|
import os
|
|
@@ -29,15 +28,7 @@ def import_local():
|
|
|
29
28
|
assert cwd[-5:] == "tests",("Expected current working directory to be in a 'tests' directory", cwd[-5:], "from", cwd)
|
|
30
29
|
assert cwd[-6] in ['/', '\\'],("Expected current working directory 'tests' to be lead by a '\\' or '/'", cwd[-6:], "from", cwd)
|
|
31
30
|
sys.path.insert( 0, cwd[:-6] )
|
|
32
|
-
|
|
33
|
-
# reload modules
|
|
34
|
-
import importlib as imp
|
|
35
|
-
modules = sys.modules.copy()
|
|
36
|
-
for name, mdata in modules.items():
|
|
37
|
-
if name[:len(me)] == me:
|
|
38
|
-
imp.reload(mdata)
|
|
39
|
-
print("Reloaded", name)
|
|
40
|
-
#import_local()
|
|
31
|
+
import_local()
|
|
41
32
|
|
|
42
33
|
from cdxcore.pretty import PrettyObject, Sequence
|
|
43
34
|
|
|
@@ -47,8 +38,7 @@ class A1(PrettyObject):
|
|
|
47
38
|
class A2(PrettyObject):
|
|
48
39
|
def __init__(self, x): # mandatory argument
|
|
49
40
|
self.x=x
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
|
|
52
42
|
class Test(unittest.TestCase):
|
|
53
43
|
|
|
54
44
|
|
tests/test_subdir.py
CHANGED
|
@@ -10,7 +10,6 @@ def import_local():
|
|
|
10
10
|
"""
|
|
11
11
|
In order to be able to run our tests manually from the 'tests' directory
|
|
12
12
|
we force import from the local package.
|
|
13
|
-
We also force reloading all modules to make sure we are not running old code.
|
|
14
13
|
"""
|
|
15
14
|
me = "cdxcore"
|
|
16
15
|
import os
|
|
@@ -21,14 +20,7 @@ def import_local():
|
|
|
21
20
|
assert cwd[-5:] == "tests",("Expected current working directory to be in a 'tests' directory", cwd[-5:], "from", cwd)
|
|
22
21
|
assert cwd[-6] in ['/', '\\'],("Expected current working directory 'tests' to be lead by a '\\' or '/'", cwd[-6:], "from", cwd)
|
|
23
22
|
sys.path.insert( 0, cwd[:-6] )
|
|
24
|
-
|
|
25
|
-
# reload modules
|
|
26
|
-
import importlib as imp
|
|
27
|
-
modules = sys.modules.copy()
|
|
28
|
-
for name, mdata in modules.items():
|
|
29
|
-
if name[:len(me)] == me:
|
|
30
|
-
imp.reload(mdata)
|
|
31
|
-
#import_local()
|
|
23
|
+
import_local()
|
|
32
24
|
|
|
33
25
|
"""
|
|
34
26
|
Imports
|
tests/test_uniquehash.py
CHANGED
|
@@ -14,7 +14,6 @@ def import_local():
|
|
|
14
14
|
"""
|
|
15
15
|
In order to be able to run our tests manually from the 'tests' directory
|
|
16
16
|
we force import from the local package.
|
|
17
|
-
We also force reloading all modules to make sure we are not running old code.
|
|
18
17
|
"""
|
|
19
18
|
me = "cdxcore"
|
|
20
19
|
import os
|
|
@@ -25,14 +24,7 @@ def import_local():
|
|
|
25
24
|
assert cwd[-5:] == "tests",("Expected current working directory to be in a 'tests' directory", cwd[-5:], "from", cwd)
|
|
26
25
|
assert cwd[-6] in ['/', '\\'],("Expected current working directory 'tests' to be lead by a '\\' or '/'", cwd[-6:], "from", cwd)
|
|
27
26
|
sys.path.insert( 0, cwd[:-6] )
|
|
28
|
-
|
|
29
|
-
# reload modules
|
|
30
|
-
import importlib as imp
|
|
31
|
-
modules = sys.modules.copy()
|
|
32
|
-
for name, mdata in modules.items():
|
|
33
|
-
if name[:len(me)] == me:
|
|
34
|
-
imp.reload(mdata)
|
|
35
|
-
#import_local()
|
|
27
|
+
import_local()
|
|
36
28
|
|
|
37
29
|
"""
|
|
38
30
|
Imports
|
tests/test_util.py
CHANGED
|
@@ -13,7 +13,6 @@ def import_local():
|
|
|
13
13
|
"""
|
|
14
14
|
In order to be able to run our tests manually from the 'tests' directory
|
|
15
15
|
we force import from the local package.
|
|
16
|
-
We also force reloading all modules to make sure we are not running old code.
|
|
17
16
|
"""
|
|
18
17
|
me = "cdxcore"
|
|
19
18
|
import os
|
|
@@ -24,18 +23,36 @@ def import_local():
|
|
|
24
23
|
assert cwd[-5:] == "tests",("Expected current working directory to be in a 'tests' directory", cwd[-5:], "from", cwd)
|
|
25
24
|
assert cwd[-6] in ['/', '\\'],("Expected current working directory 'tests' to be lead by a '\\' or '/'", cwd[-6:], "from", cwd)
|
|
26
25
|
sys.path.insert( 0, cwd[:-6] )
|
|
26
|
+
import_local()
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
import importlib as imp
|
|
30
|
-
modules = sys.modules.copy()
|
|
31
|
-
for name, mdata in modules.items():
|
|
32
|
-
if name[:len(me)] == me:
|
|
33
|
-
imp.reload(mdata)
|
|
34
|
-
#import_local()
|
|
35
|
-
|
|
36
|
-
from cdxcore.util import is_function, is_atomic, is_float, is_filename
|
|
28
|
+
from cdxcore.util import is_function, is_atomic, is_float, is_filename, qualified_name
|
|
37
29
|
from cdxcore.util import fmt, fmt_seconds, fmt_list, fmt_dict, fmt_big_number, fmt_digits, fmt_big_byte_number, fmt_datetime, fmt_date, fmt_time, fmt_timedelta, fmt_filename, DEF_FILE_NAME_MAP
|
|
38
30
|
|
|
31
|
+
class qA(object):
|
|
32
|
+
|
|
33
|
+
M = 0
|
|
34
|
+
|
|
35
|
+
def __init__(self):
|
|
36
|
+
self.m = 1
|
|
37
|
+
|
|
38
|
+
def f(self):
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def g(self):
|
|
43
|
+
return 1
|
|
44
|
+
|
|
45
|
+
@staticmethod
|
|
46
|
+
def h():
|
|
47
|
+
pass
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def j(cls):
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
def __iter__(self):
|
|
54
|
+
yield 1
|
|
55
|
+
|
|
39
56
|
class Test(unittest.TestCase):
|
|
40
57
|
|
|
41
58
|
def test_fmt(self):
|
|
@@ -361,6 +378,79 @@ class Test(unittest.TestCase):
|
|
|
361
378
|
self.assertFalse( is_float(np.int32(0.1)) )
|
|
362
379
|
self.assertFalse( is_float(np.int64(0.1)) )
|
|
363
380
|
self.assertFalse( is_float(np.complex64(0.1)) )
|
|
381
|
+
|
|
382
|
+
# qualified
|
|
383
|
+
|
|
384
|
+
class qB(object):
|
|
385
|
+
|
|
386
|
+
M = 0
|
|
387
|
+
|
|
388
|
+
def __init__(self):
|
|
389
|
+
self.m = 1
|
|
390
|
+
|
|
391
|
+
def f(self):
|
|
392
|
+
pass
|
|
393
|
+
|
|
394
|
+
@property
|
|
395
|
+
def g(self):
|
|
396
|
+
return 1
|
|
397
|
+
|
|
398
|
+
@staticmethod
|
|
399
|
+
def h():
|
|
400
|
+
pass
|
|
401
|
+
|
|
402
|
+
@classmethod
|
|
403
|
+
def j(cls):
|
|
404
|
+
pass
|
|
405
|
+
|
|
406
|
+
def __iter__(self):
|
|
407
|
+
yield 1
|
|
408
|
+
|
|
409
|
+
qa = qA()
|
|
410
|
+
qb = qB()
|
|
411
|
+
|
|
412
|
+
modname = __name__
|
|
413
|
+
|
|
414
|
+
self.assertEqual( qualified_name(qualified_name,True), ("qualified_name", "cdxcore.util"))
|
|
415
|
+
self.assertEqual( qualified_name(is_atomic,True), ("is_atomic", "cdxcore.util"))
|
|
416
|
+
self.assertEqual( qualified_name(datetime.datetime,True), ("datetime", "datetime"))
|
|
417
|
+
self.assertEqual( qualified_name(datetime.datetime.date,True), ("datetime.date", "builtins"))
|
|
418
|
+
self.assertEqual( qualified_name(datetime.datetime.now(),True), ("datetime", "datetime"))
|
|
419
|
+
self.assertEqual( qualified_name(datetime.datetime.now().date(),True), ("date", "datetime"))
|
|
420
|
+
|
|
421
|
+
self.assertEqual( qualified_name(qA), "qA")
|
|
422
|
+
self.assertEqual( qualified_name(qA,True), ("qA",modname) )
|
|
423
|
+
self.assertEqual( qualified_name(qA.M,True), ("int","builtins") )
|
|
424
|
+
self.assertEqual( qualified_name(qA.f,True), ("qA.f",modname) )
|
|
425
|
+
self.assertEqual( qualified_name(qA.g,True), ("qA.g",modname) ) # <-- property function
|
|
426
|
+
self.assertEqual( qualified_name(qA.h,True), ("qA.h",modname) )
|
|
427
|
+
self.assertEqual( qualified_name(qA.j,True), ("qA.j",modname) )
|
|
428
|
+
|
|
429
|
+
self.assertEqual( qualified_name(qa), "qA")
|
|
430
|
+
self.assertEqual( qualified_name(qa,True), ("qA",modname) )
|
|
431
|
+
self.assertEqual( qualified_name(qa.M,True), ("int","builtins") )
|
|
432
|
+
self.assertEqual( qualified_name(qa.m,True), ("int","builtins") )
|
|
433
|
+
self.assertEqual( qualified_name(qa.f,True), ("qA.f",modname) )
|
|
434
|
+
self.assertEqual( qualified_name(qa.g,True), ("int","builtins") ) # <-- property type
|
|
435
|
+
self.assertEqual( qualified_name(qa.h,True), ("qA.h",modname) )
|
|
436
|
+
self.assertEqual( qualified_name(qa.j,True), ("qA.j",modname) )
|
|
437
|
+
|
|
438
|
+
self.assertEqual( qualified_name(qB), "Test.test_basics.<locals>.qB")
|
|
439
|
+
self.assertEqual( qualified_name(qB,True), ("Test.test_basics.<locals>.qB",modname) )
|
|
440
|
+
self.assertEqual( qualified_name(qB.M,True), ("int","builtins") )
|
|
441
|
+
self.assertEqual( qualified_name(qB.f,True), ("Test.test_basics.<locals>.qB.f",modname) )
|
|
442
|
+
self.assertEqual( qualified_name(qB.g,True), ("Test.test_basics.<locals>.qB.g",modname) ) # <-- property function
|
|
443
|
+
self.assertEqual( qualified_name(qB.h,True), ("Test.test_basics.<locals>.qB.h",modname) )
|
|
444
|
+
self.assertEqual( qualified_name(qB.j,True), ("Test.test_basics.<locals>.qB.j",modname) )
|
|
445
|
+
|
|
446
|
+
self.assertEqual( qualified_name(qb), "Test.test_basics.<locals>.qB")
|
|
447
|
+
self.assertEqual( qualified_name(qb,True), ("Test.test_basics.<locals>.qB",modname) )
|
|
448
|
+
self.assertEqual( qualified_name(qb.M,True), ("int","builtins") )
|
|
449
|
+
self.assertEqual( qualified_name(qb.m,True), ("int","builtins") )
|
|
450
|
+
self.assertEqual( qualified_name(qb.f,True), ("Test.test_basics.<locals>.qB.f",modname) )
|
|
451
|
+
self.assertEqual( qualified_name(qb.g,True), ("int","builtins") ) # <-- property type
|
|
452
|
+
self.assertEqual( qualified_name(qb.h,True), ("Test.test_basics.<locals>.qB.h",modname) )
|
|
453
|
+
self.assertEqual( qualified_name(qb.j,True), ("Test.test_basics.<locals>.qB.j",modname) )
|
|
364
454
|
|
|
365
455
|
if __name__ == '__main__':
|
|
366
456
|
unittest.main()
|
tests/test_verbose.py
CHANGED
|
@@ -10,7 +10,6 @@ def import_local():
|
|
|
10
10
|
"""
|
|
11
11
|
In order to be able to run our tests manually from the 'tests' directory
|
|
12
12
|
we force import from the local package.
|
|
13
|
-
We also force reloading all modules to make sure we are not running old code.
|
|
14
13
|
"""
|
|
15
14
|
me = "cdxcore"
|
|
16
15
|
import os
|
|
@@ -21,15 +20,7 @@ def import_local():
|
|
|
21
20
|
assert cwd[-5:] == "tests",("Expected current working directory to be in a 'tests' directory", cwd[-5:], "from", cwd)
|
|
22
21
|
assert cwd[-6] in ['/', '\\'],("Expected current working directory 'tests' to be lead by a '\\' or '/'", cwd[-6:], "from", cwd)
|
|
23
22
|
sys.path.insert( 0, cwd[:-6] )
|
|
24
|
-
|
|
25
|
-
# reload modules
|
|
26
|
-
import importlib as imp
|
|
27
|
-
modules = sys.modules.copy()
|
|
28
|
-
for name, mdata in modules.items():
|
|
29
|
-
if name[:len(me)] == me:
|
|
30
|
-
imp.reload(mdata)
|
|
31
|
-
print("Reloaded", name)
|
|
32
|
-
#import_local()
|
|
23
|
+
import_local()
|
|
33
24
|
|
|
34
25
|
from cdxcore.verbose import Context
|
|
35
26
|
from cdxcore.uniquehash import unique_hash32 as unique_hash
|
tests/test_version.py
CHANGED
|
@@ -10,7 +10,6 @@ def import_local():
|
|
|
10
10
|
"""
|
|
11
11
|
In order to be able to run our tests manually from the 'tests' directory
|
|
12
12
|
we force import from the local package.
|
|
13
|
-
We also force reloading all modules to make sure we are not running old code.
|
|
14
13
|
"""
|
|
15
14
|
me = "cdxcore"
|
|
16
15
|
import os
|
|
@@ -21,14 +20,7 @@ def import_local():
|
|
|
21
20
|
assert cwd[-5:] == "tests",("Expected current working directory to be in a 'tests' directory", cwd[-5:], "from", cwd)
|
|
22
21
|
assert cwd[-6] in ['/', '\\'],("Expected current working directory 'tests' to be lead by a '\\' or '/'", cwd[-6:], "from", cwd)
|
|
23
22
|
sys.path.insert( 0, cwd[:-6] )
|
|
24
|
-
|
|
25
|
-
# reload modules
|
|
26
|
-
import importlib as imp
|
|
27
|
-
modules = sys.modules.copy()
|
|
28
|
-
for name, mdata in modules.items():
|
|
29
|
-
if name[:len(me)] == me:
|
|
30
|
-
imp.reload(mdata)
|
|
31
|
-
#import_local()
|
|
23
|
+
import_local()
|
|
32
24
|
|
|
33
25
|
"""
|
|
34
26
|
Imports
|
cdxcore-0.1.10.dist-info/RECORD
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
cdxcore/__init__.py,sha256=DzMRN-6SAKCjFPYC72fGXBql03834TWP2QnjtPSb_vc,127
|
|
2
|
-
cdxcore/config.py,sha256=YnIEJVFtMZ5EHlwzaB2JsSkCPhWPvEw9QSpe6mof_V4,98472
|
|
3
|
-
cdxcore/crman.py,sha256=jOw40Bh6PkmEiabA7OS9NsqF-9viam3CBiKzPwxVkVw,5693
|
|
4
|
-
cdxcore/err.py,sha256=SIJMBXKXYI_hiysv5iSPRy0w_BbxyTDPbNEs56Y94Rk,14541
|
|
5
|
-
cdxcore/jcpool.py,sha256=OzoXWBJKWaDgJm1OeUj9ERz9skvwslGOwNq0wbKtcFM,17222
|
|
6
|
-
cdxcore/pretty.py,sha256=iUpgUCwmI8yb5O-WZFJEk3QvNYcj_GIFHUgZ5lK8F2I,17082
|
|
7
|
-
cdxcore/pretty.py_bak.py,sha256=JgWr5044HzCNGG0wKSAWlWiPRs7-bNzkwiKH0T3n0to,28658
|
|
8
|
-
cdxcore/subdir.py,sha256=ceL-Od5NAlJX3f4mYgwki5EMzbs-LpG5M2cikC8eFIE,173868
|
|
9
|
-
cdxcore/uniquehash.py,sha256=g-D8pqPIppSdRq5QfdE5aP3paZ-NkXWHfnn-uNB7fmg,50648
|
|
10
|
-
cdxcore/util.py,sha256=0fp0EzeZvnje1Q7SUcgB_JtKpsYgGTfvlHVfq0mE_ug,31930
|
|
11
|
-
cdxcore/verbose.py,sha256=nKNoZQwl3eF1zBf-JZwPC-lL9d_o5mJsDsSUMixTMLw,29882
|
|
12
|
-
cdxcore/version.py,sha256=m30oI2Ortg44dKSim-sIoeh9PioD1FWsSfVEP5rubhk,27173
|
|
13
|
-
cdxcore-0.1.10.dist-info/licenses/LICENSE,sha256=M-cisgK9kb1bqVRJ7vrCxHcMQQfDxdY3c2YFJJWfNQg,1090
|
|
14
|
-
docs/source/conf.py,sha256=Owctibh5XcSpSNcrpOr3ROIDjoklmFVrMhu8cOSe50o,4180
|
|
15
|
-
tests/test_config.py,sha256=0U9vFIKDex0Il-7Vc_C4saAuXoHIsdQ8YhhS8AO7FQI,15950
|
|
16
|
-
tests/test_crman.py,sha256=jYDxqF__iq3fEjaZQoq66CNChWRoR79Ntyng5mr3sIA,1698
|
|
17
|
-
tests/test_err.py,sha256=VbVmbaB6o49G-n3t7yuJ4M0d9pyUQyJuVDqK-xRrLo8,3458
|
|
18
|
-
tests/test_pretty.py,sha256=5TmF7c1TRDSN-YR5yo04SiLJiW3bZaxpXHJ-4ZEO8hg,11952
|
|
19
|
-
tests/test_subdir.py,sha256=tO-zoOIKQtZEMpQM-tsrisyLRmMH8txCSOzh6jPRhYY,11721
|
|
20
|
-
tests/test_uniquehash.py,sha256=ldoQLT77R7odMAok4Yo3jmiUIH3VPHKoSiSLKbbM_mo,24907
|
|
21
|
-
tests/test_util.py,sha256=DZ6AlPFDNNlkqP5MlM1BUwmBJvEj4WCFqZcdh_Isflw,19955
|
|
22
|
-
tests/test_verbose.py,sha256=7JGCLKHU1HovO6UYSLLcJQxjaZxYJejS1fl8O3Sgk9w,5037
|
|
23
|
-
tests/test_version.py,sha256=eq7bNT0GefbUkwEzo658UUxgBCiR7CDhuIxAmnnI-qQ,4658
|
|
24
|
-
tmp/deferred.py,sha256=TirvzxYXWnZkOWuEMB7qsf6auilfy4VD_zPknYCjrnw,9401
|
|
25
|
-
tmp/dynaplot.py,sha256=kwrH_WccpJcfS7n_gzdAr4QxQobvIZZrrxgdsKLKfj0,48552
|
|
26
|
-
tmp/filelock.py,sha256=HqnHZhSCESaOA3ClrdWPW_GZpyo7c3VRSEofAV-khKM,18137
|
|
27
|
-
tmp/np.py,sha256=2MynhiaTfmx984Gz7TwfZH3t7GCmCAQiyeWzDDCL6_k,47686
|
|
28
|
-
tmp/npio.py,sha256=4Kwp5H4MgKHkOEhu4UJ5CcwpM7Pm8UFkaoL5FvOEFRI,10310
|
|
29
|
-
tmp/sharedarray.py,sha256=JuHuSlxA0evD0a-bEZgTFrfdlVPMgzfQNgfSjr1212w,11484
|
|
30
|
-
up/git_message.py,sha256=EfSH7Pit3ZoCiRqSMwRCUN_QyuwreU4LTIyGSutBlm4,123
|
|
31
|
-
up/pip_modify_setup.py,sha256=Esaml4yA9tFsqxLhk5bWSwvKCURONjQqfyChgFV2TSY,1584
|
|
32
|
-
cdxcore-0.1.10.dist-info/METADATA,sha256=CR4ZGaCL36hx08u3KnBdB5TWKM8Sknk2W_KsCptAv4g,754
|
|
33
|
-
cdxcore-0.1.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
34
|
-
cdxcore-0.1.10.dist-info/top_level.txt,sha256=phNSwCyJFe7UP2YMoi8o6ykhotatlIbJHjTp9EHM51k,26
|
|
35
|
-
cdxcore-0.1.10.dist-info/RECORD,,
|