Пример #1
0
    def test_backslash(self):
        # Backslash means line continuation:
        res = plz.parse_config(test_backslash_1)
        self.failUnless(res['x'] == 2)

        res = plz.parse_config(test_backslash_2)
        self.failUnless(res['x'] == 0)
Пример #2
0
    def test_string_literals(self):
        # test some string definitions.
        res = plz.parse_config(test_string_literals_1)
        self.failUnless(len(res['x']) == 0 and res['x'] == res['y'])

        res = plz.parse_config(test_string_literals_2)
        self.failUnless(len(res['x']) == 1
                        and res['x'] == res['y'] and ord(res['x']) == 39)

        res = plz.parse_config(test_string_literals_3)
        self.failUnless(len(res['x']) == 1
                        and res['x'] == res['y'] and ord(res['x']) == 34)
        
        res = plz.parse_config(test_string_literals_4)
        self.failUnless(len(res['x']) == 24 and res['x'] == res['y'])

        res = plz.parse_config(test_string_literals_5)
        self.failUnless(len(res['x']) == 24 and res['x'] == res['y'])

        res = plz.parse_config(test_string_literals_6)
        self.failUnless(res['x'] == res['y'])

        res = plz.parse_config(test_string_literals_6
                                  + test_string_literals_7)
        self.failUnless(res['x'] == res['y'])

        res = plz.parse_config(test_string_literals_6
                                  + test_string_literals_8)
        self.failUnless(res['x'] == res['y'])

        res = plz.parse_config(test_string_literals_6
                                  + test_string_literals_9)
        self.failUnless(res['x'] == res['y'])
Пример #3
0
 def test_atoms(self):
     res = plz.parse_config(test_atoms_1)
Пример #4
0
 def test_stmt_suite(self):
     res = plz.parse_config(test_stmt_suite_1)
Пример #5
0
 def test_unary_ops(self):
     res = plz.parse_config(test_unary_ops_1)
Пример #6
0
 def test_multiplicative_ops(self):
     res = plz.parse_config(test_multiplicative_ops_1)
Пример #7
0
 def test_additive_ops(self):
     res = plz.parse_config(test_additive_ops_1)
Пример #8
0
 def test_shift_ops(self):
     res = plz.parse_config(test_shift_ops_1)
Пример #9
0
 def test_comparison(self):
     res = plz.parse_config(test_comparison_1)
Пример #10
0
 def test_and_or_not(self):
     res = plz.parse_config(test_and_or_not_1)
Пример #11
0
 def test_if_stmt(self):
     res = plz.parse_config(test_if_stmt_1)
Пример #12
0
 def test_long_ints(self):
     # test that the longint formats parses.
     res = plz.parse_config(test_long_ints_1)
Пример #13
0
 def test_integers(self):
     # hex, octal and large positive ints.
     res = plz.parse_config(string.lstrip(test_integers_1))
     self.failUnless(res['a'] == 255 and res['b'] == 255
                and res['c'] == 017777777777)