Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
* Replaced "tuple()" by "list()". #41
Browse files Browse the repository at this point in the history
  • Loading branch information
garciparedes committed Aug 31, 2019
1 parent cd334bc commit 39b8f85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion jinete/loaders/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, file_path: Path, *args, **kwargs):
@property
def data(self):
with self.file_path.open() as file:
data = tuple(tuple(float(v) for v in line.split()) for line in file.readlines())
data = list(list(float(v) for v in line.split()) for line in file.readlines())
return data

@property
Expand Down
16 changes: 8 additions & 8 deletions tests/test_loaders/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@

if TYPE_CHECKING:
from typing import (
Tuple,
Sequence
)


class TestFileLoader(unittest.TestCase):
directory_path: Path
file_path: Path
data: Tuple[Tuple[float, ...], ...]
data: Sequence[Sequence[float]]

@classmethod
def setUpClass(cls) -> None:
cls.directory_path = Path('/tmp/')
cls.file_path = cls.directory_path / 'jinete_problem_test.txt'
cls.data = (
(1.0, 1, 480, 6.0, 90.0),
(0.0, -1.044, 2.000, 0.0, 0.0, 0.0, 1440.0),
(1.0, -2.973, 6.414, 10.0, 1.0, 0.0, 1440.0),
(2.0, -5.476, 1.437, 10.0, -1.0, 258.0, 287.0),
)
cls.data = [
[1.0, 1, 480, 6.0, 90.0],
[0.0, -1.044, 2.000, 0.0, 0.0, 0.0, 1440.0],
[1.0, -2.973, 6.414, 10.0, 1.0, 0.0, 1440.0],
[2.0, -5.476, 1.437, 10.0, -1.0, 258.0, 287.0],
]
with cls.file_path.open('w') as file:
file.writelines('\t'.join(str(cell) for cell in row) + '\n' for row in cls.data)

Expand Down

0 comments on commit 39b8f85

Please sign in to comment.