class NBAAgent_test(unittest.TestCase): def setUp(self): self.a = NBAAgent() def test_open_file_csv(self): fname = 'files/sampleDKSalaries.csv' data = self.a.read_file(fname) self.assertIsNotNone(data) self.assertTrue(len(data) > 0) def test_save_file_csv(self): fname = '/tmp/sample.csv' data = self.a.read_file('sample.csv') self.a.save_file(data, fname) self.assertTrue(os.path.exists(fname))
class NBAAgent_test(unittest.TestCase): def setUp(self): self.a = NBAAgent() def test_open_file_csv(self): fname = 'sample.csv' data = self.a.read_file(fname) self.assertIsNotNone(data) self.assertTrue(len(data) > 0) def test_save_file_csv(self): fname = '/tmp/sample.csv' data = self.a.read_file('sample.csv') self.a.save_file(data, fname) self.assertTrue(os.path.exists(fname))
def __init__(self, db=True, safe=True, use_cache=True): # see http://stackoverflow.com/questions/8134444 NBAAgent.__init__(self) self.logger = logging.getLogger(__name__) if db: self.db = FantasyLabsNBAPg() self.safe = safe if use_cache: self.scraper = FantasyLabsNBAScraper(use_cache=use_cache) else: self.scraper = FantasyLabsNBAScraper() self.parser = FantasyLabsNBAParser()
def __init__(self, db=True, safe=True): ''' Args: db (bool): compose NBAComPg object as self.nbadb safe (bool): create backups of tables prior to inserts ''' NBAAgent.__init__(self) self.logger = logging.getLogger(__name__) self.scraper = NBAComScraper() self.parser = NBAComParser() self.safe = safe self.nbas = NBASeasons() if db: self.nbadb = NBAComPg() else: self.nbadb = None
def setUp(self): self.a = NBAAgent()