示例#1
0
    def test_no_values(self):
        # given
        price_feed_1 = FakePriceFeed()
        price_feed_2 = FakePriceFeed()
        average_price_feed = AveragePriceFeed([price_feed_1, price_feed_2])

        # expect
        assert average_price_feed.get_price().buy_price is None
        assert average_price_feed.get_price().sell_price is None
    def test_no_values(self):
        # given
        price_feed_1 = FakePriceFeed()
        price_feed_2 = FakePriceFeed()
        average_price_feed = AveragePriceFeed([price_feed_1, price_feed_2])

        # expect
        assert average_price_feed.get_price().buy_price is None
        assert average_price_feed.get_price().sell_price is None
示例#3
0
    def test_value_2(self):
        # given
        price_feed_1 = FakePriceFeed()
        price_feed_2 = FakePriceFeed()
        average_price_feed = AveragePriceFeed([price_feed_1, price_feed_2])

        # and
        price_feed_2.set_price(Wad.from_number(17.5))

        # expect
        assert average_price_feed.get_price().buy_price == Wad.from_number(17.5)
        assert average_price_feed.get_price().sell_price == Wad.from_number(17.5)
    def test_value_2(self):
        # given
        price_feed_1 = FakePriceFeed()
        price_feed_2 = FakePriceFeed()
        average_price_feed = AveragePriceFeed([price_feed_1, price_feed_2])

        # and
        price_feed_2.set_price(Wad.from_number(17.5))

        # expect
        assert average_price_feed.get_price().buy_price == Wad.from_number(17.5)
        assert average_price_feed.get_price().sell_price == Wad.from_number(17.5)