Пример #1
0
 def on_search(self, *args):
     self.stop_search()
     self.result_tree.clear()
     searchstring = self.search_field.get_text().strip()
     self._show_spinner()
     for item in asset.get_asset_for_searchstring(searchstring):
         self.insert_item(item, "")
     self.search_source_count = datasource_controller.get_source_count()
     datasource_controller.search(searchstring, self.insert_item, self.search_complete_callback)
Пример #2
0
        def bar(*args, **kwargs):
            task = threads.GeneratorTask(dsm.update_assets, None, 
                                         None, args=asset.get_all_assets())

            task.start()
            task.join()
            
            for a in asset.get_all_assets():
                self.assertNotEqual(a.date.year, 1970)
            
            self.counter += 1
            if self.counter == 2:
                Gtk.main_quit()
            else:
                # test if it works a second time (was a bug..)
                dsm.search("yahoo", callback=bar)
Пример #3
0
    def test_items_with_problems(self):
        for item in ITEMS_WITH_PROBLEMS:
            dsm.search(item, threaded=False)
            asset = objects.asset.get_asset_for_searchstring(item)[0]
            self.assertIsNotNone(asset)
            test_date = datetime.datetime(1900, 1, 1)
            asset.price = 0
            asset.date = test_date
            for foo in dsm.update_assets([asset]):
                pass
            self.assertNotEqual(asset.date, test_date)
            self.assertNotEqual(asset.price, 0)

            self.assertIsNotNone(asset)
            count = len(asset.quotations)
            self.get_historical_prices(asset)
            self.assertNotEqual(count, len(asset.quotations))
Пример #4
0
 def start():
     dsm.search("google", callback=bar)