Пример #1
0
    def test_dict_error(self):
        """ dict error """
        the_string = "{'a':1, b:2 "

        compiler = Compiler()

        try:
            compiler.compile_dict(the_string)
        except CompilerError, err:
            self.assertEqual(err.message, "Expression \"{'a':1, b:2 \" cannot be converted as a dict.")
Пример #2
0
 def test_dict_error(self):
     """ dict error """
     the_string = "{'a':1, b:2 "
             
     compiler = Compiler()
     
     try:
         compiler.compile_dict(the_string)
     except CompilerError, err:
         self.assertEqual(err.message, 'Expression "{\'a\':1, b:2 " cannot be converted as a dict.')
Пример #3
0
    def test_noquotes_dict(self):
        """ no quotes dict """

        the_string = "{ no12: a b , no10:a}"

        compiler = Compiler()

        the_result = compiler.compile_dict(the_string)

        self.assertEqual(the_result, {"no12": "a b", "no10": "a"})
Пример #4
0
    def test_dict_with_list(self):
        """ dict with list """

        the_string = "{'a':1, b:[1,2,3,4,5] }"

        compiler = Compiler()

        the_result = compiler.compile_dict(the_string)

        self.assertEqual(the_result, {"a": 1, "b": [1, 2, 3, 4, 5]})
Пример #5
0
    def test_simple_dict(self):
        """ simple dict """

        the_string = "{'a':1, b:2 }"

        compiler = Compiler()

        the_result = compiler.compile_dict(the_string)

        self.assertEqual(the_result, {"a": 1, "b": 2})
Пример #6
0
 def test_noquotes_dict(self):
     """ no quotes dict """
     
     the_string = "{ no12: a b , no10:a}"
             
     compiler = Compiler()
     
     the_result = compiler.compile_dict(the_string)
     
     self.assertEqual(the_result,{ 'no12': 'a b' , 'no10':'a'})
Пример #7
0
 def test_dict_with_list(self):
     """ dict with list """
     
     the_string = "{'a':1, b:[1,2,3,4,5] }"
             
     compiler = Compiler()
     
     the_result = compiler.compile_dict(the_string)
     
     self.assertEqual(the_result, {'a':1, 'b':[1,2,3,4,5]})
Пример #8
0
 def test_simple_dict(self):
     """ simple dict """
     
     the_string = "{'a':1, b:2 }"
             
     compiler = Compiler()
     
     the_result = compiler.compile_dict(the_string)
     
     self.assertEqual(the_result, {'a':1, 'b':2 })
 def test_noquotes_dict(self):
     """ no quotes dict """
     
     the_string = "{ no12: a b , no10:a}"
             
     compiler = Compiler()
     
     the_result = compiler.compile_dict(the_string)
     
     self.assertEqual(the_result,{ 'no12': 'a b' , 'no10':'a'})
Пример #10
0
 def ztest_compile_from_file(self):
     """ compile from file """
     
     the_file   = open('/home/aubert/dev/src-reps/java-balivernes/InfraProfiler/src/sel3_event.traj')
     
     the_string = the_file.read()
     
     compiler = Compiler()
      
     the_result = compiler.compile_dict(the_string)
     
     print(the_result)