Skip to content

Commit

Permalink
Merge b34e7ad into 799b9ef
Browse files Browse the repository at this point in the history
  • Loading branch information
k1o0 committed Nov 16, 2021
2 parents 799b9ef + b34e7ad commit 5c7750e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 14 additions & 2 deletions alyx/data/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# from django.test import TestCase
from uuid import uuid4

# Create your tests here.
from django.test import TestCase

from . import transfers


class TransferUtilTests(TestCase):
def test_add_uuid_to_filename(self):
uuid = uuid4()
expected = f'spikes.times.{uuid}.npy'
testable = transfers._add_uuid_to_filename('spikes.times.npy', uuid)
self.assertEqual(expected, testable)
# Check leaves UUID if already added
self.assertEqual(expected, transfers._add_uuid_to_filename(testable, uuid))
2 changes: 2 additions & 0 deletions alyx/data/transfers.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ def _incomplete_dataset_ids():


def _add_uuid_to_filename(fn, uuid):
if str(uuid) in fn:
return fn
dpath, ext = op.splitext(fn)
return dpath + '.' + str(uuid) + ext

Expand Down

0 comments on commit 5c7750e

Please sign in to comment.