示例#1
0
    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())
示例#2
0
    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())
示例#3
0
    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())
示例#4
0
    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)
示例#5
0
    def test_lazy_result(self):
        mock = self.Mock('hello world')
        lazy_result = LazyResult(mock.value)

        self.assertEqual('hello world', lazy_result.evaluate())