def testAsciiLineWithSymbolsIsTooLong(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/asciiLineLength3.xml')
         validateFile(file[0])
         assert len(w) == 1
 def testAsciiLineTooLongRaisesError(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/asciiLineLength1.xml')
         validateFile(file[0])
         assert len(w) == 1
 def testAsciiLineWithLeadingWhitespaceIsValid(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/asciiLineLength2.xml')
         validateFile(file[0])
     assert len(w) == 0
 def testAsciiCharactersAfterEndLineLogsWarning(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/asciiEndLineTrailingCharacters.xml')
         validateFile(file[0])
         assert len(w) == 1
 def testTooManyEndLinesLogsWarning(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/asciiExcessiveEndLines.xml')
         validateFile(file[0])
         assert len(w) == 1
 def testAsciiWithoutEndlineLogsWarning(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/asciiWithoutEndline.xml')
         validateFile(file[0])
         assert len(w) == 1
 def testMisspelledSymbolRaisesError(self):
     with self.assertRaises(ParseError) as cm:
         file = glob.glob('./test/misspelledSymbol.xml')
         validateFile(file[0])
 def testValidateFileWithSymbols(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/symbols.xml')
         validateFile(file[0])
         assert len(w) == 0
 def testValidateBasicFile(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/base.xml')
         validateFile(file[0])
         assert len(w) == 0
Exemple #10
0
import argparse
import glob
import os

from parseXml import validateFile
from ElementTree import ParseError

parser = argparse.ArgumentParser(description='Validate SNSC3 script files.')
parser.add_argument('folders',
                    type=str,
                    nargs='+',
                    help='Folder(s) containing XML files to validate.')
args = parser.parse_args()

num_files = 0
for folder in args.folders:
    for file in glob.glob('../{}/*.xml'.format(folder)):
        validateFile(file)