def test_nor(self): transpiler = Transpiler() py_line = transpiler.transpile_line( "If Tommy is nobody nor Billy is nobody\n") self.assertEqual(py_line, "if not Tommy == False or Billy == False:\n")
def test_divide_numbers(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Put 1 over 3 into my pocket\n') self.assertEqual(py_line, 'my_pocket = 1 / 3\n')
def test_decrement(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Knock the hate down\n') self.assertEqual(py_line, 'the_hate -= 1\n')
def test_subtract_numbers(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Put 1 minus 3 into my pocket\n') self.assertEqual(py_line, 'my_pocket = 1 - 3\n')
def test_multiply_numbers(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Put 1 times 3 into my pocket\n') self.assertEqual(py_line, 'my_pocket = 1 * 3\n')
def test_put_into_poetic_assigns_variable(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Put a flower into the vase\n') self.assertEqual(py_line, 'the_vase = a_flower\n')
def test_put_into_numeric(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Put 3.14 into PI\n') self.assertEqual(py_line, 'PI = 3.14\n')
def test_is_numeric(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Seven is 11\n') self.assertEqual(py_line, 'Seven = 11\n')
def test_is_numeric_with_dot(self): transpiler = Transpiler() py_line = transpiler.transpile_line('X is 1.23\n') self.assertEqual(py_line, 'X = 1.23\n')
def test_proper_variables(self): transpiler = Transpiler() py_line = transpiler.transpile_line( "Master Of The Universe is nothing\n") self.assertEqual(py_line, "Master_Of_The_Universe = False\n")
logger.info("Received modified event - %s." % event.src_path) # TODO check its the right file ?? for func in watches: sFuncPath = os.path.abspath(func) sSrcPath = os.path.abspath(event.src_path) #print(sFuncPath, sSrcPath) if sFuncPath == sSrcPath: watches[func]() some = FileSystemEventHandler() some.on_any_event = dosomat observer.schedule(some, ".") transpiler = Transpiler() def extract(dct, namespace=None): if not namespace: namespace = globals() namespace.update(dct) def rockstar(text, namespace=None, printname=None): if (os.path.isfile(text)): rsf(text, namespace, printname) else: rs(text, namespace, printname) def _rsf(filename, namespace=None, printname=None):
def test_compund_addition_assignment(self): transpiler = Transpiler() py_line = transpiler.transpile_line("Let X be with 10\n") self.assertEqual(py_line, "X += 10\n")
def test_add_poetic(self): transpiler = Transpiler() py_line = transpiler.transpile_line( "Put this with that into my pocket\n") self.assertEqual(py_line, "my_pocket = this + that\n")
def test_add_numbers(self): transpiler = Transpiler() py_line = transpiler.transpile_line("Put 1 plus 3 into my pocket\n") self.assertEqual(py_line, "my_pocket = 1 + 3\n")
def test_let_be_string(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Let the letter be "R"\n') self.assertEqual(py_line, 'the_letter = "R"\n')
def test_is_poetic_with_dot(self): transpiler = Transpiler() py_line = transpiler.transpile_line('My dreams were ice. A life unfulfilled; wakin\' everybody up, taking booze and pills\n') self.assertEqual(py_line, 'my_dreams = 3.1415926535\n')
def test_put_into_bool(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Put nothing into my hand\n') self.assertEqual(py_line, 'my_hand = False\n')
def test_is_poetic_and_numeric(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Car is 4 W D\n') self.assertEqual(py_line, 'Car = 411\n')
def test_is_bool(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Life is ok\n') self.assertEqual(py_line, 'Life = True\n')
def test_is_poetic_keyword(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Tommy was without\n') self.assertEqual(py_line, 'Tommy = 7\n')
def test_put_into_string(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Put "letter" into the envelope\n') self.assertEqual(py_line, 'the_envelope = "letter"\n')
def test_is_string(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Message is "Hello"\n') self.assertEqual(py_line, 'Message = "Hello"\n')
def test_subtract_poetic(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Put this without that into my pocket\n') self.assertEqual(py_line, 'my_pocket = this - that\n')
def test_let_be_bool(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Let my beer be empty\n') self.assertEqual(py_line, 'my_beer = False\n')
def test_multiply_poetic(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Put this of that into my pocket\n') self.assertEqual(py_line, 'my_pocket = this * that\n')
def test_let_be_poetic(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Let Stuart be a yellow Minion\n') self.assertEqual(py_line, 'Stuart = 166\n')
def test_divide_poetic(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Put this over that into my pocket\n') self.assertEqual(py_line, 'my_pocket = this / that\n')
def test_let_be_numeric(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Let One be 0\n') self.assertEqual(py_line, 'One = 0\n')
def test_increment(self): transpiler = Transpiler() py_line = transpiler.transpile_line('Build my money up\n') self.assertEqual(py_line, 'my_money += 1\n')
def test_aint(self): transpiler = Transpiler() py_line = transpiler.transpile_line("If Tommy ain't nobody\n") self.assertEqual(py_line, "if Tommy != False:\n")