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
import pytest | |
param = pytest.mark.parametrize | |
def primes(num): | |
factors = [] | |
divisor = 1 | |
while num > 1: | |
divisor += 1 | |
while (num % divisor == 0): |
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
def munge(txt): | |
if len(txt) <= 3: | |
return txt | |
return txt[0] + txt[-2:0:-1] + txt[-1] | |
def test_three(): | |
assert munge('abc') == 'abc' | |
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 hamcrest.core.base_matcher import BaseMatcher | |
from hamcrest import assert_that, is_not, is_ | |
from datetime import date | |
class SundayMatcher(BaseMatcher): | |
def matches(self, item, mismatch_description=None): | |
return item.weekday() == 6 |
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
~$ ipython | |
Python 2.7.2+ (default, Oct 4 2011, 20:06:09) | |
Type "copyright", "credits" or "license" for more information. | |
IPython 0.10.2 -- An enhanced Interactive Python. | |
? -> Introduction and overview of IPython's features. | |
%quickref -> Quick reference. | |
help -> Python's own help system. | |
object? -> Details about 'object'. ?object also works, ?? prints 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
pip install watchdog | |
watchmedo shell-command -c ./runtests_local.sh -p "*.py" -R |
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
fizzbuzz = for n in [1..100] | |
if n % 15 is 0 | |
'fizzbuzz' | |
else if n % 3 is 0 | |
'fizz' | |
else if n % 5 is 0 | |
'buzz' | |
else | |
n |
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
dgram = require "dgram" | |
server = dgram.createSocket "udp4" | |
client = dgram.createSocket "udp4" | |
finish = -> | |
client.close() | |
server.close() | |
process.exit() |
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
package kata; | |
import java.util.Arrays; | |
import java.util.List; | |
import org.junit.Test; | |
import static org.junit.Assert.*; | |
public class RomanNumbersTest { |
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
package kata; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import org.junit.Test; | |
import static org.junit.Assert.*; |
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
call_command('flush', interactive=False, verbosity=0) | |
call_command('loaddata', filename, verbosity=0, traceback=True) | |
NewerOlder