def test_recursive_lazy_result_via_list(self): mock = self.Mock('hello world') lazy_result = LazyResult(mock.value) mock2 = self.Mock([lazy_result]) lazy_result2 = LazyResult(mock2.value) self.assertEqual(['hello world'], lazy_result2.evaluate())
def test_recursive_lazy_result_via_dictionary(self): mock = self.Mock('hello world') lazy_result = LazyResult(mock.value) mock2 = self.Mock({'data': lazy_result}) lazy_result2 = LazyResult(mock2.value) self.assertEqual({'data': 'hello world'}, lazy_result2.evaluate())
def test_recursive_lazy_result(self): mock = self.Mock('hello world') lazy_result = LazyResult(mock.value) mock2 = self.Mock(lazy_result) lazy_result2 = LazyResult(mock2.value) self.assertEqual('hello world', lazy_result2.evaluate())
def test_recursive_lazy_result_via_lazy_result_in_property_containing_model( self): mock = self.Mock([self.MockModel(data='hello world')]) lazy_result = LazyResult(mock.value) mock2 = self.Mock(self.MockModel(data=lazy_result)) lazy_result2 = LazyResult(mock2.value) result_attributes = lazy_result2.evaluate().attributes self.assertEqual(['data'], list(result_attributes.keys())) self.assertEqual({'data': 'hello world'}, result_attributes['data'][0].attributes)
def test_lazy_result(self): mock = self.Mock('hello world') lazy_result = LazyResult(mock.value) self.assertEqual('hello world', lazy_result.evaluate())