Пример #1
0
 def test_all_ids_known3(self):
     string_to_file("#PREDICATE #(x).(x>0 & x<10)", file_name)
     ast_string = file_to_AST_str(file_name)
     root = str_ast_to_python_ast(ast_string)
     
     env = Environment()
     assert all_ids_known(root, env)==False
Пример #2
0
 def test_all_ids_known4(self):
     string_to_file("#PREDICATE ID={x|x>0 & x<10}", file_name)
     ast_string = file_to_AST_str(file_name)
     root = str_ast_to_python_ast(ast_string)
     
     env = Environment()
     env.add_ids_to_frame(["ID"])
     assert all_ids_known(root, env)==False        
Пример #3
0
 def test_all_ids_known(self):
     string_to_file("#PREDICATE x=y & x=42", file_name)
     ast_string = file_to_AST_str(file_name)
     root = str_ast_to_python_ast(ast_string)
     
     env = Environment()
     env.add_ids_to_frame(["x","y"])
     assert all_ids_known(root, env)==False
Пример #4
0
 def test_all_ids_known5(self):
     string_to_file("#PREDICATE ID={x|x>0 & x<10}", file_name)
     ast_string = file_to_AST_str(file_name)
     root = str_ast_to_python_ast(ast_string)
     
     env = Environment()
     env.add_ids_to_frame(["ID"])
     env.set_value("ID", frozenset([1,2,3])) # would be false
     assert all_ids_known(root, env)==True
Пример #5
0
 def test_all_ids_known6(self):
     string_to_file("#PREDICATE {(1,2)}:S<->T", file_name)
     ast_string = file_to_AST_str(file_name)
     root = str_ast_to_python_ast(ast_string)
     
     env = Environment()
     env.add_ids_to_frame(["S","T"])
     env.set_value("S", frozenset([1,2,3,4,5]))
     env.set_value("T", frozenset([1,2,3,4,5]))  
     assert all_ids_known(root, env)==True