コード例 #1
0
            self.assertGreater( len(something), 1 )
        result4 = self.UMs.getTypicalNoteSets( 'xr' )
        self.assertTrue( isinstance( result4, tuple ) )
        self.assertLess( len(result4), len(result1) )
        for something in result4:
            self.assertTrue( isinstance( something , list ) )
            self.assertTrue( something )
            self.assertGreater( len(something), 1 )
        result5 = self.UMs.getTypicalNoteSets( 'pq' )
        self.assertEqual( result5, None )
    #end of test_2200_getTypicalNoteSets

    def test_2210_getMarkerListFromText( self ):
        """ Test the getMarkerListFromText function. """
        self.assertEqual( self.UMs.getMarkerListFromText(''), [] )
        self.assertEqual( self.UMs.getMarkerListFromText('This is just plain text.'), [] )
        self.assertEqual( self.UMs.getMarkerListFromText('This \\bk book\\bk* is good'), \
                                [('bk',5,' ','\\bk ',['bk'],1,'book'), ('bk',13,'*','\\bk*',[],None,' is good')] )
    #end of test_2210_getMarkerListFromText
# end of USFMMarkersTests class


if __name__ == '__main__':
    # Configure basic set-up
    parser = BibleOrgSysGlobals.setup( ProgName, ProgVersion )
    BibleOrgSysGlobals.addStandardOptionsAndProcess( parser )

    if BibleOrgSysGlobals.verbosityLevel > 1: print( ProgNameVersion )

    unittest.main() # Automatically runs all of the above tests
# end of USFMMarkersTests.py
コード例 #2
0
        print( gsc ) # Just print a summary

        if BibleOrgSysGlobals.commandLineArguments.export:
            print( "Exports aren't written yet!" )
            #hlc.exportDataToPython() # Produce the .py tables
            #hlc.exportDataToC() # Produce the .h tables
            halt


    if 1: # demonstrate the Greek Lexicon class
        if BibleOrgSysGlobals.verbosityLevel > 1: print( "\nDemonstrating the Greek Lexicon class…" )
        hl = GreekLexicon( testFolder ) # Load and process the XML
        print( hl ) # Just print a summary
        print()
        for strongsKey in ('G1','G123','G165','G1732','G1979','G2011','G5624','G5625',): # Last one is invalid
            print( '\n' + strongsKey )
            print( " Data:", hl.getStrongsEntryData( strongsKey ) )
            print( " Pronunciation:", hl.getStrongsEntryField( strongsKey, 'pronunciation' ) )
            print( " HTML:", hl.getStrongsEntryHTML( strongsKey ) )
# end of demo

if __name__ == '__main__':
    # Configure basic set-up
    parser = BibleOrgSysGlobals.setup( ProgName, ProgVersion )
    BibleOrgSysGlobals.addStandardOptionsAndProcess( parser, exportAvailable=True )

    demo()

    BibleOrgSysGlobals.closedown( ProgName, ProgVersion )
# end of GreekLexicon.py
コード例 #3
0
    newText, count2 = re.subn( regex, that, text )
    if count2!=count1 and BibleOrgSysGlobals.verbosityLevel > 2:
        print( "  " + _("Deleted {:,} occurrence{} of regex {!r}").format( count2, '' if count==2 else 's', this ) )

    count3 = len( re.findall( regex, newText ) )
    if count3: # and BibleOrgSysGlobals.verbosityLevel > 0:
        logging.critical( "  " + _("NOTE: {:,} occurrence{} of regex {!r} still remaining!").format( count3, '' if count3==1 else 's', this ) )
    return newText
# end of noisyRegExDeleteAll



def demo():
    """
    Demo program to handle command line parameters and then run some short test/demo functions.
    """
    if BibleOrgSysGlobals.verbosityLevel>0: print( ProgNameVersion )

# end of NoisyReplaceFunctions.demo


if __name__ == '__main__':
    # Configure basic set-up
    parser = BibleOrgSysGlobals.setup( ProgName, ProgVersion )
    BibleOrgSysGlobals.addStandardOptionsAndProcess( parser )

    demo()

    BibleOrgSysGlobals.closedown( ProgName, ProgVersion )
# end of NoisyReplaceFunctions.py
コード例 #4
0
ファイル: SwordBible.py プロジェクト: wangsamas/BibleOrgSys
            for j, someFolder in enumerate(sorted(foundFolders)):
                if BibleOrgSysGlobals.verbosityLevel > 1:
                    print("\nSword E{}/ Trying {}".format(j + 1, someFolder))
                #myTestFolder = os.path.join( testFolder, someFolder+'/' )
                testSwB(testFolder, someFolder)


# end of demo

if __name__ == '__main__':
    multiprocessing.freeze_support(
    )  # Multiprocessing support for frozen Windows executables

    import sys
    if 'win' in sys.platform:  # Convert stdout so we don't get zillions of UnicodeEncodeErrors
        from io import TextIOWrapper
        sys.stdout = TextIOWrapper(
            sys.stdout.detach(), sys.stdout.encoding,
            'namereplace' if sys.version_info >=
            (3, 5) else 'backslashreplace')

    # Configure basic Bible Organisational System (BOS) set-up
    parser = BibleOrgSysGlobals.setup(ProgName, ProgVersion)
    BibleOrgSysGlobals.addStandardOptionsAndProcess(parser,
                                                    exportAvailable=True)

    demo()

    BibleOrgSysGlobals.closedown(ProgName, ProgVersion)
# end of SwordBible.py