Skip to content

Commit

Permalink
fix: fix 210
Browse files Browse the repository at this point in the history
  • Loading branch information
terryyz committed May 2, 2024
1 parent b586cb7 commit 99943b4
Show file tree
Hide file tree
Showing 5 changed files with 623 additions and 620 deletions.
11 changes: 6 additions & 5 deletions data/clean/f_210_wending_chien_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ def test_incorrect_format_log(self):

def test_partial_correct_log(self):
partial_log_content = "ERROR: [2023-03-23 15:00:00] - Correct message\nThis is not a correct log format\n"
with patch('builtins.open', mock_open(read_data=partial_log_content)) as mock_file:
generated_csv_path = f_210('partial.log')
self.assertTrue(os.path.exists(generated_csv_path), "CSV file was not created for partial correct log.")
generated_df = pd.read_csv(generated_csv_path)
self.assertEqual(len(generated_df), 1, "Only one correct log entry should be parsed.")
with open(self.sample_log_file, 'w') as log_file:
log_file.write(partial_log_content)
generated_csv_path = f_210(self.sample_log_file)
self.assertTrue(os.path.exists(generated_csv_path), "CSV file was not created for partial correct log.")
generated_df = pd.read_csv(generated_csv_path)
self.assertEqual(len(generated_df), 1, "Only one correct log entry should be parsed.")

def test_malformed_timestamp(self):
malformed_content = "ERROR: [2023-00-23 15:00:00] - Malformed timestamp"
Expand Down
1,210 changes: 605 additions & 605 deletions data/open-eval.jsonl

Large diffs are not rendered by default.

Binary file modified data/open-eval.jsonl.gz
Binary file not shown.
11 changes: 6 additions & 5 deletions data/processed/f_210_wending_chien_edit_wo_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ def test_incorrect_format_log(self):
f_589('incorrect.log')
def test_partial_correct_log(self):
partial_log_content = "ERROR: [2023-03-23 15:00:00] - Correct message\nThis is not a correct log format\n"
with patch('builtins.open', mock_open(read_data=partial_log_content)) as mock_file:
generated_csv_path = f_589('partial.log')
self.assertTrue(os.path.exists(generated_csv_path), "CSV file was not created for partial correct log.")
generated_df = pd.read_csv(generated_csv_path)
self.assertEqual(len(generated_df), 1, "Only one correct log entry should be parsed.")
with open(self.sample_log_file, 'w') as log_file:
log_file.write(partial_log_content)
generated_csv_path = f_589(self.sample_log_file)
self.assertTrue(os.path.exists(generated_csv_path), "CSV file was not created for partial correct log.")
generated_df = pd.read_csv(generated_csv_path)
self.assertEqual(len(generated_df), 1, "Only one correct log entry should be parsed.")
def test_malformed_timestamp(self):
malformed_content = "ERROR: [2023-00-23 15:00:00] - Malformed timestamp"
with patch('builtins.open', mock_open(read_data=malformed_content)):
Expand Down
11 changes: 6 additions & 5 deletions data/raw/f_210_wending_chien_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ def test_incorrect_format_log(self):

def test_partial_correct_log(self):
partial_log_content = "ERROR: [2023-03-23 15:00:00] - Correct message\nThis is not a correct log format\n"
with patch('builtins.open', mock_open(read_data=partial_log_content)) as mock_file:
generated_csv_path = f_210('partial.log')
self.assertTrue(os.path.exists(generated_csv_path), "CSV file was not created for partial correct log.")
generated_df = pd.read_csv(generated_csv_path)
self.assertEqual(len(generated_df), 1, "Only one correct log entry should be parsed.")
with open(self.sample_log_file, 'w') as log_file:
log_file.write(partial_log_content)
generated_csv_path = f_210(self.sample_log_file)
self.assertTrue(os.path.exists(generated_csv_path), "CSV file was not created for partial correct log.")
generated_df = pd.read_csv(generated_csv_path)
self.assertEqual(len(generated_df), 1, "Only one correct log entry should be parsed.")

def test_malformed_timestamp(self):
malformed_content = "ERROR: [2023-00-23 15:00:00] - Malformed timestamp"
Expand Down

0 comments on commit 99943b4

Please sign in to comment.