def main(args): """ Main command-line entrypoint. """ if len(args) == 0 or set(args) & {"-h", "--help"}: print(HELP_MSG) return HELP_MSG else: if set(args) & {"-p", "--path"}: database._path() if set(args) & {"-d", "--drop"}: confirm_drop = input("Are you sure you want to DROP all tables? [Y/N] /> ") if confirm_drop.strip().lower() in ("y", "yes"): database._dropTables() else: print("Cancelled dropping tables. Exiting.") return None if set(args) & {"-c", "--create"}: database._createTables() database._baseLabels() if set(args) & {"-P", "--populate"}: if len(args) == 2 and args[1].isdigit(): limit = int(args[1]) else: limit = None database._populate(limit) if set(args) & {"-s", "--summary"}: print("Getting table summary...") table_counts.showTableCounts()
def test_insert(self): database._dropTables(verbose=False) database._createTables(verbose=False) database._baseLabels() t = Trend(topic="abc", volume=1) self.assertEqual(t.topic, "abc") self.assertEqual(t.volume, 1) t = Trend(topic="a b Ç 😊", volume=1000) self.assertEqual(t.topic, "a b Ç 😊") database._dropTables(verbose=False)
def tearDown(self): database._dropTables(verbose=False)
def test_drop(self): database._dropTables()