Skip to content

Commit

Permalink
Move version definition to the appropriate file
Browse files Browse the repository at this point in the history
  • Loading branch information
alej0varas committed May 30, 2024
1 parent 4fba923 commit e5d0b9e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/bcp/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import bandcamplib, player, gui # noqa: F401
__VERSION__ = "v0.1.4"
2 changes: 1 addition & 1 deletion src/bcp/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .player import Player
from .utils import get_clipboad_content, threaded

__VERSION__ = "v0.1.3"
from . import __VERSION__
_log = get_loger(__name__)

DEFAULT_FONT_SIZE = 20
Expand Down
2 changes: 1 addition & 1 deletion tests/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../src")))

import bcp
from bcp import bandcamplib # noqa: F401, E402
26 changes: 13 additions & 13 deletions tests/tests_bandcamplib.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
import unittest

from . import constants
from .context import bcp
from .context import bandcamplib

bcp.bandcamplib.DEBUG = True
bcp.bandcamplib.THROTTLE_TIME = 1
bandcamplib.DEBUG = True
bandcamplib.THROTTLE_TIME = 1


class MainTests(unittest.TestCase):
def test_get_track_from_artist_url(self):
url = f"https://{constants.BC_BANDNAME}.bandcamp.com/"
for mp3_info in bcp.bandcamplib.get_mp3s_from_url(url):
for mp3_info in bandcamplib.get_mp3s_from_url(url):
print(mp3_info)
break

def test_get_track_from_music_url(self):
url = f"https://{constants.BC_BANDNAME}.bandcamp.com/music"
for mp3_info in bcp.bandcamplib.get_mp3s_from_url(url):
for mp3_info in bandcamplib.get_mp3s_from_url(url):
pass

def test_get_mp3s_from_album_url(self):
url = f"https://{constants.BC_BANDNAME}.bandcamp.com/album/{constants.BC_ALBUMNAME}"
for mp3_info in bcp.bandcamplib.get_mp3s_from_url(url):
for mp3_info in bandcamplib.get_mp3s_from_url(url):
pass

def test_get_mp3s_from_track_url(self):
url = f"https://{constants.BC_BANDNAME}.bandcamp.com/track/{constants.BC_TRACKNAME}>"
for mp3_info in bcp.bandcamplib.get_mp3s_from_url(url):
url = f"https://{constants.BC_BANDNAME}.bandcamp.com/track/{constants.BC_TRACKNAME}"
for mp3_info in bandcamplib.get_mp3s_from_url(url):
pass

def test_get_albums_urls_from_url(self):
url = f"https://{constants.BC_BANDNAME}.bandcamp.com/music"
bcp.bandcamplib._get_albums_urls_from_url(url)
bandcamplib._get_albums_urls_from_url(url)

def test_validate_url(self):
url = "https://bandcamp.com"
with self.assertRaises(ValueError) as cm:
bcp.bandcamplib._validate_url(url)
bandcamplib._validate_url(url)
self.assertEqual("No band subdomain", str(cm.exception))

url = "https://bandname.someothercamp.com"
with self.assertRaises(ValueError) as cm:
bcp.bandcamplib._validate_url(url)
bandcamplib._validate_url(url)
self.assertEqual("Not a bandcamp URL", str(cm.exception))
url = "http://bandname.bandcamp.com"
with self.assertRaises(ValueError) as cm:
bcp.bandcamplib._validate_url(url)
bandcamplib._validate_url(url)
self.assertEqual("No https", str(cm.exception))

url = "https://t4.bc-not-bits.com/stream/"
with self.assertRaises(ValueError) as cm:
bcp.bandcamplib._validate_url(url)
bandcamplib._validate_url(url)
self.assertEqual("Not a bandcamp URL", str(cm.exception))

0 comments on commit e5d0b9e

Please sign in to comment.