Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_constant_success(good_code):
assert compiler.compile_code(good_code) is not None
def test_variable_declaration_exception(bad_code):
with raises(VariableDeclarationException):
compiler.compile_code(bad_code)
def test_varname_validity_success(good_code):
assert compiler.compile_code(good_code) is not None
def test_compilation_fails_with_exception(bad_code, exception_type):
with raises(exception_type):
compiler.compile_code(bad_code)
def test_chain_success(good_code):
assert compiler.compile_code(good_code) is not None
def test_bytes_fail(bad_code):
if isinstance(bad_code, tuple):
with raises(bad_code[1]):
compiler.compile_code(bad_code[0])
else:
with raises(TypeMismatchException):
compiler.compile_code(bad_code)
def test_tuple_assign_fail(bad_code):
if isinstance(bad_code, tuple):
with raises(bad_code[1]):
compiler.compile_code(bad_code[0])
else:
with raises(TypeMismatchException):
compiler.compile_code(bad_code)
def test_block_success(good_code):
assert compiler.compile_code(good_code) is not None
def test_list_success(good_code):
assert compiler.compile_code(good_code) is not None
def test_type_mismatch_exception(bad_code):
with raises(TypeMismatchException):
compiler.compile_code(bad_code)