#!/usr/bin/env python """ Update the ask_generated.py file This must be run each time known_facts is changed Should be run from sympy root directory $ python sympy/assumptions/ask_update.py """ from sympy.assumptions.ask import (compute_known_facts, known_facts, known_facts_keys) f = open('sympy/assumptions/ask_generated.py', 'w') code = compute_known_facts(known_facts, known_facts_keys) f.write(code) f.close()
#!/usr/bin/env python """ Update the ask_generated.py file This must be run each time known_facts is changed Should be run from sympy root directory $ python bin/ask_update.py """ # hook in-tree SymPy into Python path, if possible import os import sys isympy_path = os.path.abspath(__file__) isympy_dir = os.path.dirname(isympy_path) sympy_top = os.path.split(isympy_dir)[0] sympy_dir = os.path.join(sympy_top, 'sympy') if os.path.isdir(sympy_dir): sys.path.insert(0, sympy_top) from sympy.assumptions.ask import (compute_known_facts, get_known_facts, get_known_facts_keys) with open('sympy/assumptions/ask_generated.py', 'w') as f: code = compute_known_facts(get_known_facts(), get_known_facts_keys()) f.write(code)
def test_compute_known_facts(): ns = {} exec "from sympy.logic.boolalg import And, Or, Not" in globals(), ns exec compute_known_facts() in globals(), ns assert ns["known_facts_cnf"] == known_facts_cnf assert ns["known_facts_dict"] == known_facts_dict
#!/usr/bin/env python """ Update the ask_generated.py file This must be run each time known_facts is changed Should be run from sympy root directory $ python bin/ask_update.py """ # hook in-tree SymPy into Python path, if possible import os import sys isympy_path = os.path.abspath(__file__) isympy_dir = os.path.dirname(isympy_path) sympy_top = os.path.split(isympy_dir)[0] sympy_dir = os.path.join(sympy_top, 'sympy') if os.path.isdir(sympy_dir): sys.path.insert(0, sympy_top) from sympy.assumptions.ask import (compute_known_facts, known_facts, known_facts_keys) with open('sympy/assumptions/ask_generated.py', 'w') as f: code = compute_known_facts(known_facts, known_facts_keys) f.write(code)
def test_compute_known_facts(): ns = {} exec 'from sympy.logic.boolalg import And, Or, Not' in globals(), ns exec compute_known_facts() in globals(), ns assert ns['known_facts_cnf'] == known_facts_cnf assert ns['known_facts_dict'] == known_facts_dict