示例#1
0
 def test_evaluateParameters2(self):
     '''flaghelper: parse and evaluate a string with a single quote inside'''
     
     # Dividers for string 
     first = ' '
     second = '='
     reference = OrderedDict([('mode', "manual"), ('field', "It A'int a Field")])
     
     # cmd with single quote inside a string
     cmd = "mode='manual' field='It A'int a Field'"
     myparser = fh.Parser(first,second)
     
     res = myparser.parseNoEval(cmd)
     
     # evaluate parameters to fix single quote 
     resdict = fh.evaluateParameters(res)
     self.assertDictEqual(reference, resdict, 'Failed to evaluateParameters with single quote in value')
示例#2
0
 def test_parseNoEval3(self):
     '''flaghelper: CAS-6553 parse and evaluate a string with whitespaces'''
     
     # Dividers for string 
     first = ' '
     second = '='
     reference = OrderedDict([('mode', "tfcrop"), ('antenna', 'ea24')])
     
     # cmd with whitespace in the begin and end
     cmd = " mode='tfcrop' antenna='ea24' "
     myparser = fh.Parser(first,second)
     
     res = myparser.parseNoEval(cmd)
     
     # evaluate parameters to fix single quote left dangling
     resdict = fh.evaluateParameters(res)
     self.assertDictEqual(reference, resdict, 'Failed to parserNoEval() with whitespaces at begin and end')
示例#3
0
 def test_evaluateParameters1(self):
     '''flaghelper: parse and evaluate a string with a many extra whitespaces'''
     
     # Dividers for string 
     first = ' '
     second = '='
     reference = OrderedDict([('mode', "manual"), ('antenna', 'ea24'), ('spw', '0'), ('reason', 'MY WHITESPACES')])
     
     # cmd with single quote inside a string
     cmd = " mode='manual'   antenna='ea24'      spw='0'   reason='MY WHITESPACES'"
     myparser = fh.Parser(first,second)
     
     res = myparser.parseNoEval(cmd)
     
     # evaluate parameters to fix single quote 
     resdict = fh.evaluateParameters(res)
     self.assertDictEqual(reference, resdict, 'Failed to evaluateParameters with many whitespaces')
示例#4
0
 def test_parseNoEval2(self):
     '''flaghelper: CAS-6553 parse and evaluate a string with whitespaces'''
     
     # Dividers for string 
     first = ' '
     second = '='
     reference = OrderedDict([('mode', "extend"), ('antenna', 'ea24'), ('flagnearfreq', True)])
     
     # cmd with whitespace between pairs and at the end
     cmd = "mode='extend' antenna='ea24 '  flagnearfreq=True" 
     myparser = fh.Parser(first,second)
     
     # test parseNoEval()
     res = myparser.parseNoEval(cmd)
     
     # evaluate parameters to fix single quote
     resdict = fh.evaluateParameters(res)
     self.assertDictEqual(reference, resdict, 'Failed to parserNoEval() with whitespaces in value')
示例#5
0
    def test_parseNoEval3(self):
        '''flaghelper: CAS-6553 parse and evaluate a string with whitespaces'''

        # Dividers for string
        first = ' '
        second = '='
        reference = OrderedDict([('mode', "tfcrop"), ('antenna', 'ea24')])

        # cmd with whitespace in the begin and end
        cmd = " mode='tfcrop' antenna='ea24' "
        myparser = fh.Parser(first, second)

        res = myparser.parseNoEval(cmd)

        # evaluate parameters to fix single quote left dangling
        resdict = fh.evaluateParameters(res)
        self.assertDictEqual(
            reference, resdict,
            'Failed to parserNoEval() with whitespaces at begin and end')
示例#6
0
    def test_evaluateParameters2(self):
        '''flaghelper: parse and evaluate a string with a single quote inside'''

        # Dividers for string
        first = ' '
        second = '='
        reference = OrderedDict([('mode', "manual"),
                                 ('field', "It A'int a Field")])

        # cmd with single quote inside a string
        cmd = "mode='manual' field='It A'int a Field'"
        myparser = fh.Parser(first, second)

        res = myparser.parseNoEval(cmd)

        # evaluate parameters to fix single quote
        resdict = fh.evaluateParameters(res)
        self.assertDictEqual(
            reference, resdict,
            'Failed to evaluateParameters with single quote in value')
示例#7
0
    def test_evaluateParameters1(self):
        '''flaghelper: parse and evaluate a string with a many extra whitespaces'''

        # Dividers for string
        first = ' '
        second = '='
        reference = OrderedDict([('mode', "manual"), ('antenna', 'ea24'),
                                 ('spw', '0'), ('reason', 'MY WHITESPACES')])

        # cmd with single quote inside a string
        cmd = " mode='manual'   antenna='ea24'      spw='0'   reason='MY WHITESPACES'"
        myparser = fh.Parser(first, second)

        res = myparser.parseNoEval(cmd)

        # evaluate parameters to fix single quote
        resdict = fh.evaluateParameters(res)
        self.assertDictEqual(
            reference, resdict,
            'Failed to evaluateParameters with many whitespaces')
示例#8
0
    def test_parseNoEval2(self):
        '''flaghelper: CAS-6553 parse and evaluate a string with whitespaces'''

        # Dividers for string
        first = ' '
        second = '='
        reference = OrderedDict([('mode', "extend"), ('antenna', 'ea24'),
                                 ('flagnearfreq', True)])

        # cmd with whitespace between pairs and at the end
        cmd = "mode='extend' antenna='ea24 '  flagnearfreq=True"
        myparser = fh.Parser(first, second)

        # test parseNoEval()
        res = myparser.parseNoEval(cmd)

        # evaluate parameters to fix single quote
        resdict = fh.evaluateParameters(res)
        self.assertDictEqual(
            reference, resdict,
            'Failed to parserNoEval() with whitespaces in value')