Beispiel #1
0
    def test_init__should_set_value_and_doc(self, init_val):
        docstr = 'test doc'

        obj = DocValue(init_val, docstr)

        assert obj.value is init_val
        assert obj.doc == docstr
Beispiel #2
0
    def test_object_interface__should_act_as_initial_value(self, init_val):
        docstr = 'test doc'

        obj = DocValue(init_val, docstr)

        assert obj == init_val
        assert isinstance(obj, init_val.__class__)
        assert repr(obj) == repr(init_val)
Beispiel #3
0
    def test_deepcopy__should_return_different_object(self, init_val):
        docstr = 'test doc'
        obj = DocValue(init_val, docstr)

        copied = deepcopy(obj)

        assert copied.value == init_val
        assert copied.doc == docstr
        assert copied is not obj
Beispiel #4
0
 def test_init__if_wrong_value_type_was_passed__should_raise_error(self, init_val):
     with pytest.raises(TypeError):
         DocValue(init_val, 'doc')  # noqa