Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 15, 2023
1 parent 2807139 commit a2fb364
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions tests/tests_fabric/loggers/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import pytest
import torch
import csv

from lightning.fabric.loggers import CSVLogger
from lightning.fabric.loggers.csv_logs import _ExperimentWriter
Expand Down Expand Up @@ -131,13 +130,13 @@ def test_append_columns(tmp_path):
# new key appears
metrics = {"a": 1, "b": 2, "c": 3}
logger.log_metrics(metrics)
with open(logger.experiment.metrics_file_path, "r") as file:
with open(logger.experiment.metrics_file_path) as file:
header = file.readline().strip()
assert set(header.split(",")) == {"step", "a", "b", "c"}

# key disappears
metrics = {"a": 1, "c": 3}
logger.log_metrics(metrics)
with open(logger.experiment.metrics_file_path, "r") as file:
with open(logger.experiment.metrics_file_path) as file:
header = file.readline().strip()
assert set(header.split(",")) == {"step", "a", "b", "c"}
4 changes: 2 additions & 2 deletions tests/tests_pytorch/loggers/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ def test_append_columns(tmp_path):
# new key appears
metrics = {"a": 1, "b": 2, "c": 3}
logger.log_metrics(metrics)
with open(logger.experiment.metrics_file_path, "r") as file:
with open(logger.experiment.metrics_file_path) as file:
header = file.readline().strip()
assert set(header.split(",")) == {"step", "a", "b", "c"}

# key disappears
metrics = {"a": 1, "c": 3}
logger.log_metrics(metrics)
with open(logger.experiment.metrics_file_path, "r") as file:
with open(logger.experiment.metrics_file_path) as file:
header = file.readline().strip()
assert set(header.split(",")) == {"step", "a", "b", "c"}

0 comments on commit a2fb364

Please sign in to comment.