Skip to content

Commit

Permalink
remove no longer useful test
Browse files Browse the repository at this point in the history
  • Loading branch information
alisterburt committed Nov 18, 2024
1 parent cb7d5d4 commit 9f7d5b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
14 changes: 1 addition & 13 deletions tests/test_functional_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import pandas as pd
import pytest
import starfile

import starfile
from .constants import loop_simple, postprocess, test_df, test_data_directory


Expand All @@ -29,18 +29,6 @@ def test_write():
assert output_file.exists()


def test_write_overwrites_with_backup():
output_file = test_data_directory / 'test_overwrite_backup.star'
starfile.write(test_df, output_file)
assert output_file.exists()

starfile.write(test_df, output_file)
backup = test_data_directory / 'test_overwrite_backup.star~'
assert backup.exists()
starfile.write(test_df, output_file)
assert backup.exists()


def test_read_non_existent_file():
f = Path('non-existent-file.star')
assert f.exists() is False
Expand Down
21 changes: 12 additions & 9 deletions tests/test_writing.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .constants import loop_simple, postprocess, test_data_directory, test_df
from .utils import generate_large_star_file, remove_large_star_file


def test_write_simple_block():
s = StarParser(postprocess)
output_file = test_data_directory / 'basic_block.star'
Expand Down Expand Up @@ -72,19 +73,19 @@ def test_can_write_non_zero_indexed_one_row_dataframe():
assert (expected in output)


@pytest.mark.parametrize("quote_character, quote_all_strings, num_quotes",
@pytest.mark.parametrize("quote_character, quote_all_strings, num_quotes",
[('"', False, 6),
('"', True, 8),
("'", False, 6),
("'", True, 8)
])
])
def test_string_quoting_loop_datablock(quote_character, quote_all_strings, num_quotes, tmp_path):
df = pd.DataFrame([[1,"nospace", "String with space", " ", ""]],
columns=["a_number","string_without_space", "string_space", "just_space", "empty_string"])
df = pd.DataFrame([[1, "nospace", "String with space", " ", ""]],
columns=["a_number", "string_without_space", "string_space", "just_space", "empty_string"])

filename = tmp_path / "test.star"
StarWriter(df, filename, quote_character=quote_character, quote_all_strings=quote_all_strings).write()

# Test for the appropriate number of quotes
with open(filename) as f:
star_content = f.read()
Expand All @@ -93,6 +94,7 @@ def test_string_quoting_loop_datablock(quote_character, quote_all_strings, num_q
s = StarParser(filename)
assert df.equals(s.data_blocks[""])


def test_writing_speed():
start = time.time()
generate_large_star_file()
Expand All @@ -102,13 +104,14 @@ def test_writing_speed():
# Check that execution takes less than a second
assert end - start < 1

@pytest.mark.parametrize("quote_character, quote_all_strings, num_quotes",

@pytest.mark.parametrize("quote_character, quote_all_strings, num_quotes",
[('"', False, 6),
('"', True, 8),
("'", False, 6),
("'", True, 8)
])
def test_string_quoting_simple_datablock(quote_character, quote_all_strings,num_quotes, tmp_path):
])
def test_string_quoting_simple_datablock(quote_character, quote_all_strings, num_quotes, tmp_path):
o = {
"a_number": 1,
"string_without_space": "nospace",
Expand All @@ -119,7 +122,7 @@ def test_string_quoting_simple_datablock(quote_character, quote_all_strings,num_

filename = tmp_path / "test.star"
StarWriter(o, filename, quote_character=quote_character, quote_all_strings=quote_all_strings).write()

# Test for the appropriate number of quotes
with open(filename) as f:
star_content = f.read()
Expand Down

0 comments on commit 9f7d5b4

Please sign in to comment.