Beispiel #1
0
 def testAsciiLineWithSymbolsIsTooLong(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/asciiLineLength3.xml')
         validateFile(file[0])
         assert len(w) == 1
Beispiel #2
0
 def testAsciiLineTooLongRaisesError(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/asciiLineLength1.xml')
         validateFile(file[0])
         assert len(w) == 1
Beispiel #3
0
 def testAsciiLineWithLeadingWhitespaceIsValid(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/asciiLineLength2.xml')
         validateFile(file[0])
     assert len(w) == 0
Beispiel #4
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
Beispiel #5
0
 def testTooManyEndLinesLogsWarning(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/asciiExcessiveEndLines.xml')
         validateFile(file[0])
         assert len(w) == 1
Beispiel #6
0
 def testAsciiWithoutEndlineLogsWarning(self):
     with warnings.catch_warnings(record=True) as w:
         file = glob.glob('./test/asciiWithoutEndline.xml')
         validateFile(file[0])
         assert len(w) == 1
Beispiel #7
0
 def testMisspelledSymbolRaisesError(self):
     with self.assertRaises(ParseError) as cm:
         file = glob.glob('./test/misspelledSymbol.xml')
         validateFile(file[0])
Beispiel #8
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
Beispiel #9
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
Beispiel #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)