Skip to content

Commit

Permalink
extend testing and fix prompt 💲
Browse files Browse the repository at this point in the history
  • Loading branch information
0jdxt committed Oct 9, 2018
1 parent 88c2bf2 commit 3b95bcd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pyvid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ def convert_video(vid: Video) -> Tuple[bool, int]:
prompt += ' -> '
prompt += click.style(str(vid.conv_path.parent), fg='green') + '\\'
prompt += click.style(vid.conv_path.name, fg='yellow') + '\n'
prompt += 'continue? (y)es/(n)o/(c)ancel all'
click.echo(prompt)

if not vid.force:
prompt += 'continue? (y)es/(n)o/(c)ancel all'
click.echo(prompt)
opt = 'y' if vid.force else click.getchar()

if opt == 'y':
os.makedirs(vid.conv_path.parent, exist_ok=True)

Expand Down
2 changes: 1 addition & 1 deletion pyvid/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __eq__(self, other: Any) -> bool:
return os.path.samestat(os.stat(self.path), os.stat(other.path))
elif isinstance(other, Path):
return os.path.samestat(os.stat(self.path), os.stat(other))
return NotImplemented
raise NotImplementedError


class VideoPath(type(Path())):
Expand Down
10 changes: 9 additions & 1 deletion test/test_pyvid.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
from pathlib import Path

import pytest
from hurry.filesize import size

from pyvid.classes import Video


def test_video_class() -> None:
pth = Path('files/Carne_job.mov')
v_size = 20853615
vid = Video(pth, True)

assert vid == pth
assert vid.size == 20853615
assert vid.size == v_size
assert vid.force
assert vid.converted == 0
assert vid.conv_path == Path('files/converted/Carne_job.mp4')
assert repr(vid) == f'<Video {pth.name} {size(v_size)}>'
with pytest.raises(NotImplementedError):
vid == 5
vid == 'string'

0 comments on commit 3b95bcd

Please sign in to comment.