def test_updateSets_args(): s = SETTING("Default") s.updates() assert "set" not in s.keys() assert "testsetdict" not in s.keys() s.updates("set", {"testsetdict": "dict"}) assert s.get("testset") == ".json" assert s.get("testsetdict") == "dict"
def test_repeat_G652(): sets = SETTING() sets.updates('G652', 'test') print 'sets', sets resultgetcore = [] resultgetclad = [] for img in yieldImg("IMG\\G652\\mid\\"): result = G652Classify().find(img) core, clad = result['coreResult'], result['cladResult'] print core['ellipese'], clad['ellipese'] assert core['longAxisLen'] > 0.5 assert core['shortAxisLen'] > 0.5 assert core['longAxisLen'] > core['shortAxisLen'] ratio = core['shortAxisLen'] / core['longAxisLen'] assert ratio > 0.9 _1, _2 = core['corePoint'][0].tolist() radius = core['longAxisLen'] + core['shortAxisLen'] / 2 print _1, _2, radius resultgetcore.append([_1, _2, radius]) print clad['ellipese'], clad['ellipese'] assert clad['longAxisLen'] > 0.5 assert clad['shortAxisLen'] > 0.5 assert clad['longAxisLen'] > clad['shortAxisLen'] ratio = clad['shortAxisLen'] / clad['longAxisLen'] assert ratio > 0.9 _1, _2 = clad['corePoint'][0].tolist() radius = clad['longAxisLen'] + clad['shortAxisLen'] / 2 print _1, _2, radius resultgetclad.append([_1, _2, radius]) resultarray = np.array(resultgetcore) # print resultarray std = np.std(resultarray, axis=0) x, y, z = std print 'std', x, y, z assert z < 0.5 resultarray = np.array(resultgetclad) # print resultarray std = np.std(resultarray, axis=0) x, y, z = std print 'std', x, y, z assert z < 1.5
def test_updateSets_Exception(): s = SETTING("Default") try: s.updates(1) except Exception, e: assert isinstance(e, ValueError)
def test_updateSets_kwargs(): s = SETTING("Default") assert 'testkwargs' not in s.keys() s.updates(testkwargs='get') assert s.get('testkwargs') == 'get'