def test_determine_storeFromCID(self): assert psn._determine_store( "EP9000-CUSA00194_00-UNTILDAWN0000001") == "DE/de" assert psn._determine_store( "JP0006-NPJB00377_00-BATTLEFIELD40000") == "JP/jp" assert psn._determine_store( "UP2034-CUSA04841_00-NMSDIGITAL000001") == "US/en" assert psn._determine_store("1") is None
def get_alerts(alerts_filename): alerts = [] with open(alerts_filename) as csv_file: alerts_reader = csv.reader(csv_file, delimiter=",", quotechar='"') for row in alerts_reader: alert = {"cid": row[0], "price": row[1]} if len(row) >= 3: alert["store"] = row[2] # TODO wild hack and duplication of code elif "###" not in alert["cid"]: alert["store"] = psn._determine_store(alert["cid"]) alerts.append(alert) return alerts
def get_alerts(alertsFilename): alerts = [] with open(alertsFilename) as csvfile: alertsreader = csv.reader(csvfile, delimiter=',', quotechar='"') for row in alertsreader: alert = {} alert['cid'] = row[0] alert['price'] = row[1] if len(row) >= 3: alert['store'] = row[2] # TODO wild hack and duplication of code elif "###" not in alert['cid']: alert['store'] = psn._determine_store(alert["cid"]) alerts.append(alert) return alerts