def _build_graph(self):
        t_start = time.time()
        self.graph = graph.build_graph(self.offers)
        t_end = time.time()

        logging.info("Spent {}s building the graph".format(
            round(t_end - t_start, 2)))
    def test_build_graph(self):
        # Hand-crafted offers to produce a profitable path
        offers_with_vendor = [
            Offer(league="Heist",
                  have="Orb of Regret",
                  want="Chaos Orb",
                  stock=8,
                  conversion_rate=8,
                  contact_ign="some_guy"),
            Offer(league="Heist",
                  have="Orb of Alchemy",
                  want="Orb of Regret",
                  stock=8,
                  conversion_rate=1,
                  contact_ign=VENDOR_OFFER_IGN),
            Offer(league="Heist",
                  have="Chaos Orb",
                  want="Orb of Alchemy",
                  stock=100,
                  conversion_rate=.25,
                  contact_ign="some_guy"),
        ]

        graph = build_graph(offers_with_vendor)
        paths = find_paths(graph, "Chaos Orb", "Chaos Orb", user_config)

        self.assertTrue(len(paths) > 0)
Exemplo n.º 3
0
 def test_build_graph(self):
     graph = build_graph(test_offers)
     self.assertDictEqual(graph, expected_graph)