Example #1
0
def test_a_tupled_list(l):
    for x in l:
        assert type(x[0]) == int and type(x[1]) == unicode


@forall(tries=10, x=integers(), y=integers())
def test_addition_commutative(x, y):
    assert x + y == y + x


@forall(tries=10, l=lists())
def test_reverse_reverse(l):
    assert list(reversed(list(reversed(l)))) == l


@forall(tries=10, c=characters())
def test_characters(c):
    assert len(c) == 1


def kv_unicode_integers():
    u = unicodes()
    i = integers()
    while True:
        yield (u.next(), i.next())


@forall(tries=10, d=dicts(key_values=kv_unicode_integers()))
def test_dicts(d):
    for x, y in d.iteritems():
        assert type(x) == unicode
Example #2
0
        yield (i.next(), u.next())

@forall(tries=10, l=lists(items=random_int_unicode_tuple()))
def test_a_tupled_list(l):
    for x in l:
        assert type(x[0]) == int and type(x[1]) == unicode

@forall(tries=10, x=integers(), y=integers())
def test_addition_commutative(x, y):
    assert x + y == y + x

@forall(tries=10, l=lists())
def test_reverse_reverse(l):
    assert list(reversed(list(reversed(l)))) == l

@forall(tries=10, c=characters())
def test_characters(c):
    assert len(c) == 1

def kv_unicode_integers():
    u = unicodes()
    i = integers()
    while True:
        yield (u.next(), i.next())

@forall(tries=10, d=dicts(key_values=kv_unicode_integers()))
def test_dicts(d):
    for x, y in d.iteritems():
        assert type(x) == unicode
        assert type(y) == int
# -*- coding: utf-8 -*-

from korean.hangeul import *
from qc import forall, characters

@forall(character=characters(minunicode=ord(u'가'), maxunicode=ord(u'힣')))
def test_is_hanguel(character):
    assert is_hangeul(character)

@forall(character=characters(minunicode=ord(u'힣') + 1, maxunicode=65535))
def test_is_not_hangeul_greater(character):
    assert not is_hangeul(character)

@forall(character=characters(minunicode=0, maxunicode=ord(u'가') + 1))
def test_is_not_hangeul_lower(character):
    assert not is_hangeul(character)

def test_find_vowel_to_append():
    assert find_vowel_to_append(u'아프') == u'아'
    assert find_vowel_to_append(u'흐르') == u'어'
    assert find_vowel_to_append(u'태우') == u'어'
    assert find_vowel_to_append(u'만들') == u'어'
    assert find_vowel_to_append(u'앗') == u'아'

def test_join():
    assert join(u'ᄀ', u'ㅏ') == u'가'
    assert join(u'ᄆ', u'ㅕ', u'ᆫ') == u'면'
    assert join(u'ᄈ', u'ㅙ', u'ᆶ') == u'뾇'

@forall(character=characters(minunicode=ord(u'가'), maxunicode=ord(u'힣')))
def test_join_randomly(character):