This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("mathutils.php"); | |
function testSum() { | |
assert("sum(3, 5) == 8"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
class MyList(list): | |
def __init__(self, items, more): | |
# modify items here | |
new_items = map(lambda x: x + '_hi', items) | |
super(MyList, self).__init__(new_items) | |
# assign rest here | |
self.more = more |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
P 2 # select pen 2 | |
D # pen down | |
W 2 # draw west 2cm | |
N 1 # then north 1 | |
E 2 # then east 2 | |
S 1 # then back south | |
U # pen up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Operation: | |
def __eq__(self, other): | |
return self.__class__ == other.__class__ | |
def matches(self, line): | |
def zip_strs(a, b): | |
def separate(str): | |
return [char for char in str] | |
return zip(separate(a), separate(b)) | |
self.match_args = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
import Blender.BGL as GL | |
from scocca.frontend.blender.application import * | |
from scocca.frontend.blender.elements import * | |
except ImportError: | |
import OpenGL.GL as GL | |
from scocca.frontend.pyopengl.application import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from placidity.interpreter import Interpreter | |
def test_sum(): | |
interpreter = Interpreter() | |
assert interpreter.interpret('1+1') == 2 | |
def test_subtract(): | |
interpreter = Interpreter() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from placidity.interpreter import Interpreter | |
class TestInterpreter: | |
def setup_method(self, method): | |
interpreter = Interpreter() | |
self.interpret = interpreter.interpret | |
class TestAccessVariable: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
class TestUnsetVariable(TestInterpreter): | |
def test_unset_variable(self): | |
assert self.interpret('a') == 'null' | |
def test_variable_in_expression(self): | |
assert self.interpret('a+3') == 'null' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Clean: | |
aliases = 'clean' | |
description = 'Cleans up stored variables' | |
def execute(self, variables): | |
''' | |
>>> clean = Clean() | |
Cleaning empty vars should result in empty still | |
>>> variables = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mock import Mock | |
from placidity.interpreter import Interpreter | |
from placidity.utils import Operations | |
def test_execute_commands(): | |
def execute_with_commands(commands): | |
assert commands == [command, ] | |
return 'executed command' | |
def execute_with_variables(variables): |
OlderNewer