예제 #1
0
def test_input_kw_type_int():
    with pytest.raises(TypeError) as err:
        mood_ring = Ring(extend=1)
    assert 'only accepts list/dict objects' in str(err.value)
예제 #2
0
def test_custom_list_input_list_extend():
    mood_ring = Ring(dict_input_1, extend=list_input_1)
    opt_set = set(list(dict_input_1.keys()) + list_input_1)
    assert len(mood_ring.mood_opts) == len(opt_set)
    for mood in mood_ring.mood_opts:
        assert mood in opt_set
예제 #3
0
def test_input_arg_type_str():
    with pytest.raises(TypeError) as err:
        mood_ring = Ring('this mood')
    assert 'only accepts list/dict objects' in str(err.value)
예제 #4
0
def test_custom_list_input():
    mood_ring = Ring(list_input_1)
    assert len(mood_ring.mood_opts) == len(list_input_1)
    for mood in mood_ring.mood_opts:
        assert mood in list_input_1
    assert mood_ring.mood_probs == tuple([1 for m in list_input_1])
예제 #5
0
def test_extended_input_dict():
    def_len = len(_default_mood_map.keys())
    mood_ring = Ring(extend=dict_input_1)
    ext_len = len(dict_input_1.keys())
    assert len(mood_ring.mood_opts) == def_len + ext_len
예제 #6
0
def test_custom_dict_input():
    mood_list = dict_input_1.keys()
    mood_ring = Ring(dict_input_1)
    assert len(mood_ring.mood_opts) == len(dict_input_1.keys())
    for mood in mood_ring.mood_opts:
        assert mood in dict_input_1.keys()
예제 #7
0
def test_ring_change_method_next():
    mood_ring = Ring()
    old_mood = str(mood_ring)
    for _ in range(100):
        mood_ring.change()
        assert old_mood != mood_ring
예제 #8
0
def test_ring_change_method():
    mood_list = _default_mood_map.keys()
    mood_ring = Ring()
    mood_ring.change()
    assert str(mood_ring) in mood_list
예제 #9
0
def test_ring_repr_str_methods():
    mood_ring = Ring()
    assert str(mood_ring) == repr(mood_ring)
예제 #10
0
def test_ring_output_membership():
    mood_list = _default_mood_map.keys()
    mood_ring = Ring()
    assert str(mood_ring) in mood_list