def testStateCliCall(self): sys.argv = self.st_args sys.stdout = io.StringIO() addfips_cli.main() sys.stdout.seek(0) reader = csv.DictReader(sys.stdout) row = next(reader) assert row["name"] == "Alabama" assert row["fips"] == "01"
def testStateNameCliCall(self): sys.argv = self.co_args[:-2] + ["--state-name", "Alabama"] sys.stdout = io.StringIO() addfips_cli.main() sys.stdout.seek(0) reader = csv.DictReader(sys.stdout) row = next(reader) assert row["name"] == "Autauga County" assert row["fips"] == "01001"
def testCountyCliCall(self): sys.argv = self.co_args sys.stdout = io.StringIO() addfips_cli.main() sys.stdout.seek(0) reader = csv.DictReader(sys.stdout) row = next(reader) assert row["name"] == "Autauga County" assert row["fips"] == "01001"
def testStateCliCallNoHeader(self): sys.argv = self.st_args[:2] + ["-s", "1", "--no-header"] sys.stdout = io.StringIO() addfips_cli.main() sys.stdout.seek(0) reader = csv.reader(sys.stdout) next(reader) row = next(reader) assert row[1] == "Alabama" assert row[0] == "01"