Пример #1
0
def test_difference_between(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')
    s._character_by_name('Romeo').value = 4
    assert s.evaluate_expression('the difference between yourself and nothing', 'Juliet') == 4
    assert s.evaluate_expression('the difference between yourself and my chihuahua', 'Juliet') == 3
    assert s.evaluate_expression('the difference between yourself and my codpiece', 'Juliet') == 5
    assert s.evaluate_expression('the difference between yourself and my big big chihuahua', 'Juliet') == 0
    s._character_by_name('Romeo').value = 1
    assert s.evaluate_expression('the difference between yourself and nothing', 'Juliet') == 1
    assert s.evaluate_expression('the difference between yourself and my chihuahua', 'Juliet') == 0
    assert s.evaluate_expression('the difference between yourself and my codpiece', 'Juliet') == 2
    s._character_by_name('Romeo').value = 0
    assert s.evaluate_expression('the difference between thyself and nothing', 'Juliet') == 0
    assert s.evaluate_expression('the difference between yourself and my chihuahua', 'Juliet') == -1
    assert s.evaluate_expression('the difference between yourself and my codpiece', 'Juliet') == 1
    s._character_by_name('Romeo').value = -1
    assert s.evaluate_expression('the difference between yourself and nothing', 'Juliet') == -1
    assert s.evaluate_expression('the difference between yourself and my chihuahua', 'Juliet') == -2
    assert s.evaluate_expression('the difference between yourself and my codpiece', 'Juliet') == 0
    s._character_by_name('Romeo').value = -4
    assert s.evaluate_expression('the difference between yourself and nothing', 'Juliet') == -4
    assert s.evaluate_expression('the difference between yourself and my chihuahua', 'Juliet') == -5
    assert s.evaluate_expression('the difference between yourself and my codpiece', 'Juliet') == -3
    assert s.evaluate_expression('the difference between thyself and thy foul stupid devil', 'Juliet') == 0
Пример #2
0
def test_product_of(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')
    s._character_by_name('Romeo').value = 4
    assert s.evaluate_expression('the product of yourself and nothing', 'Juliet') == 0
    assert s.evaluate_expression('the product of yourself and my chihuahua', 'Juliet') == 4
    assert s.evaluate_expression('the product of yourself and my codpiece', 'Juliet') == -4
    assert s.evaluate_expression('the product of yourself and my big big chihuahua', 'Juliet') == 16
    s._character_by_name('Romeo').value = 1
    assert s.evaluate_expression('the product of yourself and nothing', 'Juliet') == 0
    assert s.evaluate_expression('the product of yourself and my chihuahua', 'Juliet') == 1
    assert s.evaluate_expression('the product of yourself and my codpiece', 'Juliet') == -1
    s._character_by_name('Romeo').value = 0
    assert s.evaluate_expression('the product of thyself and nothing', 'Juliet') == 0
    assert s.evaluate_expression('the product of yourself and my chihuahua', 'Juliet') == 0
    assert s.evaluate_expression('the product of yourself and my codpiece', 'Juliet') == 0
    s._character_by_name('Romeo').value = -1
    assert s.evaluate_expression('the product of yourself and nothing', 'Juliet') == 0
    assert s.evaluate_expression('the product of yourself and my chihuahua', 'Juliet') == -1
    assert s.evaluate_expression('the product of yourself and my codpiece', 'Juliet') == 1
    s._character_by_name('Romeo').value = -4
    assert s.evaluate_expression('the product of yourself and nothing', 'Juliet') == 0
    assert s.evaluate_expression('the product of yourself and my chihuahua', 'Juliet') == -4
    assert s.evaluate_expression('the product of yourself and my codpiece', 'Juliet') == 4
    assert s.evaluate_expression('the product of thyself and thy foul stupid devil', 'Juliet') == 16
def test_outputs_correct_character(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')

    s._character_by_name('Romeo').value = 97
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'a'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 98
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'b'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 10
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == '\n'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 65
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'A'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 66
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'B'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 9
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == '\t'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 38
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == '&'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 64
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == '@'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 32
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == ' '
    assert captured.err == ''
Пример #4
0
def test_errors_without_character_opposite(monkeypatch, capsys):
    monkeypatch.setattr(Shakespeare, 'evaluate_expression',
                        lambda x, y, z: 400)
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_dramatis_persona('Macbeth, a test.')
    s.run_event('[Enter Juliet]')

    assert s._character_by_name('Romeo').value == 0
    assert s._character_by_name('Macbeth').value == 0
    with pytest.raises(Exception) as exc:
        s.run_sentence('You are as good as me!',
                       s._on_stage_character_by_name('Juliet'))
    assert 'talking to nobody' in str(exc.value).lower()
    assert s._character_by_name('Romeo').value == 0
    assert s._character_by_name('Macbeth').value == 0

    s.run_event('[Enter Macbeth and Romeo]')
    assert s._character_by_name('Romeo').value == 0
    assert s._character_by_name('Macbeth').value == 0
    with pytest.raises(Exception) as exc:
        s.run_sentence('You are as good as me!',
                       s._on_stage_character_by_name('Juliet'))
    assert 'ambiguous' in str(exc.value).lower()
    assert s._character_by_name('Romeo').value == 0
    assert s._character_by_name('Macbeth').value == 0

    captured = capsys.readouterr()
    assert captured.out == ''
    assert captured.err == ''
Пример #5
0
def test_first_person_pronouns(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s._character_by_name('Juliet').value = 895
    assert s.evaluate_expression('me', 'Juliet') == 895
    assert s.evaluate_expression('myself', 'Juliet') == 895
    assert s.evaluate_expression('I', 'Juliet') == 895
def test_past_eof(monkeypatch, capsys):
    monkeypatch.setattr('sys.stdin', StringIO(''))
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == -1

    monkeypatch.setattr('sys.stdin', StringIO('a'))
    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 97
    captured = capsys.readouterr()

    assert captured.out == ''
    assert captured.err == ''
Пример #7
0
def test_square_root_of(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')
    s._character_by_name('Romeo').value = 16
    assert s.evaluate_expression('the square root of yourself', 'Juliet') == 4
    assert s.evaluate_expression('the square root of my big big big big chihuahua', 'Juliet') == 4
    s._character_by_name('Romeo').value = 18
    assert s.evaluate_expression('the square root of yourself', 'Juliet') == 4
    s._character_by_name('Romeo').value = 41
    assert s.evaluate_expression('the square root of yourself', 'Juliet') == 6
    s._character_by_name('Romeo').value = 1
    assert s.evaluate_expression('the square root of thyself', 'Juliet') == 1
    assert s.evaluate_expression('the square root of my chihuahua', 'Juliet') == 1
    s._character_by_name('Romeo').value = 0
    assert s.evaluate_expression('the square root of thyself', 'Juliet') == 0
    assert s.evaluate_expression('the square root of nothing', 'Juliet') == 0
    s._character_by_name('Romeo').value = -1
    with pytest.raises(Exception) as exc:
        s.evaluate_expression('the square root of thyself', 'Juliet')
    assert 'negative' in str(exc.value).lower()
    with pytest.raises(Exception) as exc:
        s.evaluate_expression('the square root of thy devil', 'Juliet')
    assert 'negative' in str(exc.value).lower()
    s._character_by_name('Romeo').value = -4
    with pytest.raises(Exception) as exc:
        s.evaluate_expression('the square root of thyself', 'Juliet')
    assert 'negative' in str(exc.value).lower()
    with pytest.raises(Exception) as exc:
        s.evaluate_expression('the square root of thy foul stupid devil', 'Juliet')
    assert 'negative' in str(exc.value).lower()
Пример #8
0
def test_character_name(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')
    s._character_by_name('Romeo').value = 895
    assert s.evaluate_expression('Romeo', 'Juliet') == 895
    s.run_event('[Exit Romeo]')
    assert s.evaluate_expression('Romeo', 'Juliet') == 895
Пример #9
0
def test_assign_character(monkeypatch, capsys):
    monkeypatch.setattr(Shakespeare, 'evaluate_expression',
                        lambda x, y, z: 400)
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')

    assert s._character_by_name('Romeo').value == 0
    s.run_sentence('You are as good as me!',
                   s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 400

    s._character_by_name('Romeo').value = 0
    s.run_sentence('You are a pig!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 400
    captured = capsys.readouterr()
    assert captured.out == ''
    assert captured.err == ''
Пример #10
0
def test_twice(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')
    s._character_by_name('Romeo').value = 4
    assert s.evaluate_expression('twice yourself', 'Juliet') == 8
    assert s.evaluate_expression('twice my big big chihuahua', 'Juliet') == 8
    s._character_by_name('Romeo').value = 1
    assert s.evaluate_expression('twice thyself', 'Juliet') == 2
    assert s.evaluate_expression('twice my chihuahua', 'Juliet') == 2
    s._character_by_name('Romeo').value = 0
    assert s.evaluate_expression('twice thyself', 'Juliet') == 0
    assert s.evaluate_expression('twice nothing', 'Juliet') == 0
    s._character_by_name('Romeo').value = -1
    assert s.evaluate_expression('twice thyself', 'Juliet') == -2
    assert s.evaluate_expression('twice thy devil', 'Juliet') == -2
    s._character_by_name('Romeo').value = -4
    assert s.evaluate_expression('twice thyself', 'Juliet') == -8
    assert s.evaluate_expression('twice thy foul stupid devil', 'Juliet') == -8
def test_eof_character_code(monkeypatch, capsys):
    monkeypatch.setattr('sys.stdin', StringIO('&'))
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 38

    # shakespearelang assumes an implicit \n at the end of files
    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 10

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == -1

    captured = capsys.readouterr()
    assert captured.out == ''
    assert captured.err == ''
def test_errors_without_digits(monkeypatch, capsys):
    monkeypatch.setattr('sys.stdin', StringIO('a123'))
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')

    with pytest.raises(Exception) as exc:
        s.run_sentence('Listen to your heart!', s._on_stage_character_by_name('Juliet'))
    assert 'no numeric input' in str(exc.value).lower()
    assert s._character_by_name('Romeo').value == 0

    monkeypatch.setattr('sys.stdin', StringIO('a123'))
    with pytest.raises(Exception) as exc:
        s.run_sentence('Listen to your heart!', s._on_stage_character_by_name('Juliet'))
    assert 'no numeric input' in str(exc.value).lower()
    assert s._character_by_name('Romeo').value == 0
    captured = capsys.readouterr()
    assert captured.out == ''
    assert captured.err == ''
def test_correctly_parses_number(monkeypatch, capsys):
    monkeypatch.setattr('sys.stdin', StringIO('4257'))
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')
    s.run_sentence('Listen to your heart!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 4257
    captured = capsys.readouterr()
    assert captured.out == ''
    assert captured.err == ''
Пример #14
0
def test_second_person_pronouns(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')
    s._character_by_name('Romeo').value = 895
    assert s.evaluate_expression('you', 'Juliet') == 895
    assert s.evaluate_expression('thou', 'Juliet') == 895
    assert s.evaluate_expression('thee', 'Juliet') == 895
    assert s.evaluate_expression('thyself', 'Juliet') == 895
    assert s.evaluate_expression('yourself', 'Juliet') == 895
Пример #15
0
def test_cube_of(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')
    s._character_by_name('Romeo').value = 4
    assert s.evaluate_expression('the cube of yourself', 'Juliet') == 64
    assert s.evaluate_expression('the cube of my golden golden chihuahua', 'Juliet') == 64
    s._character_by_name('Romeo').value = 1
    assert s.evaluate_expression('the cube of thyself', 'Juliet') == 1
    assert s.evaluate_expression('the cube of my chihuahua', 'Juliet') == 1
    s._character_by_name('Romeo').value = 0
    assert s.evaluate_expression('the cube of thyself', 'Juliet') == 0
    assert s.evaluate_expression('the cube of nothing', 'Juliet') == 0
    s._character_by_name('Romeo').value = -1
    assert s.evaluate_expression('the cube of thyself', 'Juliet') == -1
    assert s.evaluate_expression('the cube of thy devil', 'Juliet') == -1
    s._character_by_name('Romeo').value = -4
    assert s.evaluate_expression('the cube of thyself', 'Juliet') == -64
    assert s.evaluate_expression('the cube of thy foul stupid devil', 'Juliet') == -64
def test_errors_on_invalid_code(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')

    s._character_by_name('Romeo').value = 100000000
    with pytest.raises(Exception) as exc:
        s.run_sentence('Speak your mind!',
                       s._on_stage_character_by_name('Juliet'))
    assert 'invalid character code' in str(exc.value).lower()

    s._character_by_name('Romeo').value = -1
    with pytest.raises(Exception) as exc:
        s.run_sentence('Speak your mind!',
                       s._on_stage_character_by_name('Juliet'))
    assert 'invalid character code' in str(exc.value).lower()

    captured = capsys.readouterr()
    assert captured.out == ''
    assert captured.err == ''
def test_unicode(monkeypatch, capsys):
    monkeypatch.setattr('sys.stdin', StringIO('ʘɥӜआઔඦᢶᨆᵇḤ'))
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 664

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 613

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 1244

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 2310

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 2708

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 3494

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 6326

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 6662

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 7495

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 7716

    captured = capsys.readouterr()
    assert captured.out == ''
    assert captured.err == ''
def test_consumes_trailing_newline(monkeypatch, capsys):
    monkeypatch.setattr('sys.stdin', StringIO('4257\na'))
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')
    s.run_sentence('Listen to your heart!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 4257
    assert s._input_buffer == ''
    assert input() == 'a'
    captured = capsys.readouterr()
    assert captured.out == ''
    assert captured.err == ''
Пример #19
0
def test_remainder(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')
    s._character_by_name('Romeo').value = 12
    assert s.evaluate_expression('the remainder of the quotient between yourself and my chihuahua', 'Juliet') == 0
    assert s.evaluate_expression('the remainder of the quotient between yourself and my big chihuahua', 'Juliet') == 0
    assert s.evaluate_expression('the remainder of the quotient between yourself and my big big chihuahua', 'Juliet') == 0
    assert s.evaluate_expression('the remainder of the quotient between yourself and my codpiece', 'Juliet') == 0
    assert s.evaluate_expression('the remainder of the quotient between yourself and my foul codpiece', 'Juliet') == 0
    assert s.evaluate_expression('the remainder of the quotient between yourself and my foul rotten codpiece', 'Juliet') == 0
    assert s.evaluate_expression('the remainder of the quotient between yourself and yourself', 'Juliet') == 0
    assert s.evaluate_expression('the remainder of the quotient between my big big chihuahua and yourself', 'Juliet') == 4
    assert s.evaluate_expression('the remainder of the quotient between my foul rotten codpiece and yourself', 'Juliet') == -4
    s._character_by_name('Romeo').value = 23
    assert s.evaluate_expression('the remainder of the quotient between yourself and my big big big chihuahua', 'Juliet') == 7
    assert s.evaluate_expression('the remainder of the quotient between yourself and my evil foul rotten codpiece', 'Juliet') == 7

    with pytest.raises(Exception) as exc:
        s.evaluate_expression('the remainder of the quotient between yourself and nothing', 'Juliet')
    assert 'zero' in str(exc.value).lower()
def test_outputs_numbers(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')

    s._character_by_name('Romeo').value = 4100
    s.run_sentence('Open your heart!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == '4100'
    assert captured.err == ''

    s._character_by_name('Romeo').value = -5
    s.run_sentence('Open your heart!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == '-5'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 9
    s.run_sentence('Open your heart!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == '9'
    assert captured.err == ''
def test_reads_characters_accurately(monkeypatch, capsys):
    monkeypatch.setattr('sys.stdin', StringIO('ab\nAB\t&@ '))
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 97

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 98

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 10

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 65

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 66

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 9

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 38

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 64

    s.run_sentence('Open your mind!', s._on_stage_character_by_name('Juliet'))
    assert s._character_by_name('Romeo').value == 32

    captured = capsys.readouterr()
    assert captured.out == ''
    assert captured.err == ''
def test_unicode(capsys):
    s = Shakespeare()
    s.run_dramatis_persona('Juliet, a test.')
    s.run_dramatis_persona('Romeo, a test.')
    s.run_event('[Enter Romeo and Juliet]')

    s._character_by_name('Romeo').value = 664
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'ʘ'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 613
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'ɥ'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 1244
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'Ӝ'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 2310
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'आ'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 2708
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'ઔ'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 3494
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'ඦ'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 6326
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'ᢶ'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 6662
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'ᨆ'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 7495
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'ᵇ'
    assert captured.err == ''

    s._character_by_name('Romeo').value = 7716
    s.run_sentence('Speak your mind!', s._on_stage_character_by_name('Juliet'))
    captured = capsys.readouterr()
    assert captured.out == 'Ḥ'
    assert captured.err == ''