""" Authors: Peter Mawhorter Consulted: Date: 2022-5-1 Purpose: Looping recursing lab practice tests. """ import os import looping import optimism testCD = optimism.testFunctionMaybe(looping, "countDescendants") testCD.case(looping.FAMILY).checkReturnValue(16) testCD.case(looping.FAMILY[1]).checkReturnValue(6) testCD.case(looping.FAMILY[2]).checkReturnValue(6) testCD.case(looping.FAMILY[3]).checkReturnValue(3) testCD.case(looping.FAMILY[1][2]).checkReturnValue(2) testCD.case(looping.FAMILY[1][1]).checkReturnValue(1) testRHF = optimism.testFunctionMaybe(looping, "revealHiddenFiles") testRHF.case('testdir').checkPrintedLines( os.path.join("testdir", ".DS_Store"), os.path.join("testdir", ".hidden", ".DS_Store"), os.path.join("testdir", ".numbers"), os.path.join("testdir", "pset", ".DS_Store"), os.path.join("testdir", "pset", "scene", ".DS_Store"), os.path.join("testdir", "pset", "shrub", ".DS_Store"), os.path.join("testdir", "pset", "shrub", "images", ".DS_Store"), os.path.join("testdir", "remember", ".DS_Store") ) testRHF.case(os.path.join('testdir', '.hidden')).checkPrintedLines( os.path.join("testdir", ".hidden", ".DS_Store"), ) testRHF.case(os.path.join('testdir', 'pset')).checkPrintedLines( os.path.join("testdir", "pset", ".DS_Store"), os.path.join("testdir", "pset", "scene", ".DS_Store"), os.path.join("testdir", "pset", "shrub", ".DS_Store"), os.path.join("testdir", "pset", "shrub", "images", ".DS_Store"), ) testRHF.case(os.path.join('testdir', 'pset', 'shrub')).checkPrintedLines( os.path.join("testdir", "pset", "shrub", ".DS_Store"), os.path.join("testdir", "pset", "shrub", "images", ".DS_Store"), ) testLHF = optimism.testFunctionMaybe(looping, "listHiddenFiles") testLHF.case('testdir').checkReturnValue([ os.path.join("testdir", ".DS_Store"), os.path.join("testdir", ".hidden", ".DS_Store"), os.path.join("testdir", ".numbers"), os.path.join("testdir", "pset", ".DS_Store"), os.path.join("testdir", "pset", "scene", ".DS_Store"), os.path.join("testdir", "pset", "shrub", ".DS_Store"), os.path.join("testdir", "pset", "shrub", "images", ".DS_Store"), os.path.join("testdir", "remember", ".DS_Store") ]) testLHF.case(os.path.join('testdir', '.hidden')).checkReturnValue([ os.path.join("testdir", ".hidden", ".DS_Store") ]) testLHF.case(os.path.join('testdir', 'pset')).checkReturnValue([ os.path.join("testdir", "pset", ".DS_Store"), os.path.join("testdir", "pset", "scene", ".DS_Store"), os.path.join("testdir", "pset", "shrub", ".DS_Store"), os.path.join("testdir", "pset", "shrub", "images", ".DS_Store"), ]) testLHF.case(os.path.join('testdir', 'pset', 'shrub')).checkReturnValue([ os.path.join("testdir", "pset", "shrub", ".DS_Store"), os.path.join("testdir", "pset", "shrub", "images", ".DS_Store"), ])