예제 #1
0
    def test_curries_functions_to_base(self):
        m = ModelWrapper(MockModelModule(), 'test')

        m.get_x = lambda x: x
        base.get_y = lambda c, x: (c, x)

        h.assert_equal(m.get_x('foo'), 'foo')
        h.assert_equal(m.get_y('bar'), ('test', 'bar'))
예제 #2
0
    def test_delegates_to_base(self):
        m = ModelWrapper(MockModelModule(), 'test')

        m.name = 'model_name'
        base.name = 'base_name'
        base.age = 12

        h.assert_equal(m.name, 'model_name')
        h.assert_equal(m.age, 12)
예제 #3
0
 def test_raises_original_attribute_error(self):
     m = ModelWrapper(MockModelModule(), 'test')
     m.foobar("hello")