tox lint changes
This commit is contained in:
parent
15672922a7
commit
52abbba2bd
6 changed files with 100 additions and 27 deletions
|
@ -2,9 +2,9 @@
|
|||
"""
|
||||
Integration (not unit) tests for pylast.py
|
||||
"""
|
||||
import pylast
|
||||
import pytest
|
||||
|
||||
import pylast
|
||||
from .test_pylast import WRITE_TEST, TestPyLastWithLastFm
|
||||
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ Integration (not unit) tests for pylast.py
|
|||
import re
|
||||
import time
|
||||
|
||||
import pylast
|
||||
import pytest
|
||||
|
||||
import pylast
|
||||
from .test_pylast import WRITE_TEST, TestPyLastWithLastFm
|
||||
|
||||
|
||||
|
|
|
@ -6,11 +6,10 @@ import os
|
|||
import sys
|
||||
import time
|
||||
|
||||
import pylast
|
||||
import pytest
|
||||
from flaky import flaky
|
||||
|
||||
import pylast
|
||||
|
||||
WRITE_TEST = sys.version_info[:2] == (3, 8)
|
||||
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ Integration (not unit) tests for pylast.py
|
|||
"""
|
||||
import time
|
||||
|
||||
import pylast
|
||||
import pytest
|
||||
|
||||
import pylast
|
||||
from .test_pylast import WRITE_TEST, TestPyLastWithLastFm
|
||||
|
||||
|
||||
|
|
|
@ -4,13 +4,14 @@ Integration (not unit) tests for pylast.py
|
|||
"""
|
||||
import calendar
|
||||
import datetime as dt
|
||||
import inspect
|
||||
import os
|
||||
import re
|
||||
import warnings
|
||||
|
||||
import pylast
|
||||
import pytest
|
||||
|
||||
import pylast
|
||||
from .test_pylast import TestPyLastWithLastFm
|
||||
|
||||
|
||||
|
@ -361,7 +362,9 @@ class TestPyLastUser(TestPyLastWithLastFm):
|
|||
utc_end = calendar.timegm(end.utctimetuple())
|
||||
|
||||
# Act
|
||||
tracks = lastfm_user.get_recent_tracks(time_from=utc_start, time_to=utc_end, stream=False)
|
||||
tracks = lastfm_user.get_recent_tracks(
|
||||
time_from=utc_start, time_to=utc_end, stream=False
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert len(tracks) == 1
|
||||
|
@ -387,6 +390,23 @@ class TestPyLastUser(TestPyLastWithLastFm):
|
|||
assert str(tracks[0].track.artist) == "Seun Kuti & Egypt 80"
|
||||
assert str(tracks[0].track.title) == "Struggles Sounds"
|
||||
|
||||
def test_get_recent_tracks_is_streamable(self):
|
||||
# Arrange
|
||||
lastfm_user = self.network.get_user("bbc6music")
|
||||
start = dt.datetime(2020, 2, 15, 15, 00)
|
||||
end = dt.datetime(2020, 2, 15, 15, 40)
|
||||
|
||||
utc_start = calendar.timegm(start.utctimetuple())
|
||||
utc_end = calendar.timegm(end.utctimetuple())
|
||||
|
||||
# Act
|
||||
tracks = lastfm_user.get_recent_tracks(
|
||||
time_from=utc_start, time_to=utc_end, limit=None, stream=True
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert inspect.isgenerator(tracks)
|
||||
|
||||
def test_get_playcount(self):
|
||||
# Arrange
|
||||
user = self.network.get_user("RJ")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue