def setUp(self): parser = BibleOrgSysGlobals.setup(PROGRAM_NAME, PROGRAM_VERSION, LAST_MODIFIED_DATE) # BibleOrgSysGlobals.addStandardOptionsAndProcess( parser ) BibleOrgSysGlobals.preloadCommonData() testFolder = 'Tests/DataFilesForTests/USFMTest1/' # This is a RELATIVE path if os.access(testFolder, os.R_OK): # Create the USFMFilenames object self.UFns = USFMFilenames.USFMFilenames(testFolder) else: vPrint( 'Quiet', debuggingThisModule, f"Sorry, test folder '{testFolder}' doesn't exist on this computer." )
def fullDemo() -> None: """ Full demo to check class is working """ BibleOrgSysGlobals.introduceProgram(__name__, programNameVersion, LAST_MODIFIED_DATE) def demoFile(name, filename, folder, BBB): vPrint('Normal', debuggingThisModule, _("Loading {} from {}…").format(BBB, filename)) UBB = USFM2BibleBook(name, BBB) UBB.load(filename, folder, encoding) vPrint('Normal', debuggingThisModule, " ID is {!r}".format(UBB.getField('id'))) vPrint('Normal', debuggingThisModule, " Header is {!r}".format(UBB.getField('h'))) vPrint( 'Normal', debuggingThisModule, " Main titles are {!r} and {!r}".format(UBB.getField('mt1'), UBB.getField('mt2'))) #vPrint( 'Quiet', debuggingThisModule, UBB ) UBB.validateMarkers() UBBVersification = UBB.getVersification() vPrint('Info', debuggingThisModule, UBBVersification) UBBAddedUnits = UBB.getAddedUnits() vPrint('Info', debuggingThisModule, UBBAddedUnits) discoveryDict = UBB._discover() #vPrint( 'Quiet', debuggingThisModule, "discoveryDict", discoveryDict ) UBB.check() UBErrors = UBB.getCheckResults() vPrint('Info', debuggingThisModule, UBErrors) # end of fullDemoFile from BibleOrgSys.InputOutput import USFMFilenames if 1: # Test individual files -- choose one of these or add your own name, encoding, testFolder, filename, BBB = "USFM2Test", 'utf-8', BibleOrgSysGlobals.BOS_TEST_DATA_FOLDERPATH.joinpath( 'USFM2AllMarkersProject/' ), '70-MATeng-amp.usfm', 'MAT' # You can put your test file here #name, encoding, testFolder, filename, BBB = "WEB", 'utf-8', Path( '/mnt/SSDs/Bibles/English translations/WEB (World English Bible)/2012-06-23 eng-web_usfm/'), "06-JOS.usfm", "JOS" # You can put your test file here #name, encoding, testFolder, filename, BBB = "WEB", 'utf-8', Path( '/mnt/SSDs/Bibles/English translations/WEB (World English Bible)/2012-06-23 eng-web_usfm/'), "44-SIR.usfm", "SIR" # You can put your test file here #name, encoding, testFolder, filename, BBB = "Matigsalug", 'utf-8', Path( '/mnt/SSDs/Matigsalug/Bible/MBTV/'), "MBT102SA.SCP", "SA2" # You can put your test file here #name, encoding, testFolder, filename, BBB = "Matigsalug", 'utf-8', Path( '/mnt/SSDs/Matigsalug/Bible/MBTV/'), "MBT15EZR.SCP", "EZR" # You can put your test file here #name, encoding, testFolder, filename, BBB = "Matigsalug", 'utf-8', Path( '/mnt/SSDs/Matigsalug/Bible/MBTV/'), "MBT41MAT.SCP", "MAT" # You can put your test file here #name, encoding, testFolder, filename, BBB = "Matigsalug", 'utf-8', Path( '/mnt/SSDs/Matigsalug/Bible/MBTV/'), "MBT67REV.SCP", "REV" # You can put your test file here if os.access(testFolder, os.R_OK): demoFile(name, filename, testFolder, BBB) else: vPrint( 'Quiet', debuggingThisModule, _("Sorry, test folder '{}' doesn't exist on this computer."). format(testFolder)) if 0: # Test a whole folder full of files name, encoding, testFolder = "Matigsalug", 'utf-8', Path( '/mnt/SSDs/Matigsalug/Bible/MBTV/' ) # You can put your test folder here #name, encoding, testFolder = "WEB", 'utf-8', Path( '/mnt/SSDs/Bibles/English translations/WEB (World English Bible)/2012-06-23 eng-web_usfm/' ) # You can put your test folder here if os.access(testFolder, os.R_OK): vPrint('Normal', debuggingThisModule, _("Scanning {} from {}…").format(name, testFolder)) fileList = USFMFilenames.USFMFilenames( testFolder).getMaximumPossibleFilenameTuples() for BBB, filename in fileList: demoFile(name, filename, testFolder, BBB) else: vPrint( 'Quiet', debuggingThisModule, _("Sorry, test folder '{}' doesn't exist on this computer."). format(testFolder))
def fullDemo() -> None: """ Full demo to check class is working """ BibleOrgSysGlobals.introduceProgram(__name__, programNameVersion, LAST_MODIFIED_DATE) def demoFile(name, filename, folder, BBB): vPrint( 'Normal', debuggingThisModule, _("Loading {} from {}{}…").format( BBB, filename, f" from {folder}" if BibleOrgSysGlobals.verbosityLevel > 2 else '')) EBB = ESFMBibleBook(name, BBB) EBB.load(filename, folder) vPrint('Normal', debuggingThisModule, " ID is {!r}".format(EBB.getField('id'))) vPrint('Normal', debuggingThisModule, " Header is {!r}".format(EBB.getField('h'))) vPrint( 'Normal', debuggingThisModule, " Main titles are {!r} and {!r}".format(EBB.getField('mt1'), EBB.getField('mt2'))) #dPrint( 'Quiet', debuggingThisModule, EBB ) EBB.validateMarkers() EBBVersification = EBB.getVersification() vPrint('Info', debuggingThisModule, EBBVersification) UBBAddedUnits = EBB.getAddedUnits() vPrint('Info', debuggingThisModule, UBBAddedUnits) discoveryDict = EBB._discover() #dPrint( 'Quiet', debuggingThisModule, "discoveryDict", discoveryDict ) EBB.checkBook() EBErrors = EBB.getCheckResults() vPrint('Info', debuggingThisModule, EBErrors) # end of fullDemoFile from BibleOrgSys.InputOutput import USFMFilenames if 1: # Test individual files #name, testFolder, filename, BBB = "WEB", Path( '/mnt/SSDs/Bibles/English translations/WEB (World English Bible)/2012-06-23 eng-web_usfm/'), "06-JOS.usfm", "JOS" # You can put your test file here #name, testFolder, filename, BBB = "WEB", Path( '/mnt/SSDs/Bibles/English translations/WEB (World English Bible)/2012-06-23 eng-web_usfm/'), "44-SIR.usfm", "SIR" # You can put your test file here #name, testFolder, filename, BBB = "Matigsalug", Path( '/mnt/SSDs/Matigsalug/Bible/MBTV/'), "MBT102SA.SCP", "SA2" # You can put your test file here #name, testFolder, filename, BBB = "Matigsalug", Path( '/mnt/SSDs/Matigsalug/Bible/MBTV/'), "MBT15EZR.SCP", "EZR" # You can put your test file here name, testFolder, filename, BBB = "Matigsalug", Path( '/mnt/SSDs/Matigsalug/Bible/MBTV/' ), "MBT41MAT.SCP", "MAT" # You can put your test file here #name, testFolder, filename, BBB = "Matigsalug", Path( '/mnt/SSDs/Matigsalug/Bible/MBTV/'), "MBT67REV.SCP", "REV" # You can put your test file here if os.access(testFolder, os.R_OK): demoFile(name, filename, testFolder, BBB) else: vPrint( 'Quiet', debuggingThisModule, f"Sorry, test folder '{testFolder}' doesn't exist on this computer." ) if 1: # Test a whole folder full of files name, testFolder = "Matigsalug", Path( '/mnt/SSDs/Matigsalug/Bible/MBTV/' ) # You can put your test folder here #name, testFolder = "WEB", Path( '/mnt/SSDs/Bibles/English translations/WEB (World English Bible)/2012-06-23 eng-web_usfm/' ) # You can put your test folder here if os.access(testFolder, os.R_OK): vPrint('Normal', debuggingThisModule, _("Scanning {} from {}…").format(name, testFolder)) fileList = USFMFilenames.USFMFilenames( testFolder).getMaximumPossibleFilenameTuples() for BBB, filename in fileList: demoFile(name, filename, testFolder, BBB) else: vPrint( 'Quiet', debuggingThisModule, f"Sorry, test folder '{testFolder}' doesn't exist on this computer." )