# Path: gammacat/info.py
# class GammaCatStr:
#     """Make and parse strings (e.g. filenames).
#     """
# 
#     @staticmethod
#     def reference_folder(meta):
#         return GammaCatStr.reference_id_str(meta)
# 
#     @staticmethod
#     def data_filename(meta):
#         return GammaCatStr.reference_folder(meta['reference_id']) + \
#             '/tev-' + GammaCatStr.source_id_str(meta['source_id'])
# 
#     @staticmethod
#     def source_id_str(source_id):
#         return '{:06d}'.format(source_id)
# 
#     @staticmethod
#     def reference_id_str(reference_id):
#         return urllib.parse.quote(reference_id)


from gammacat.info import GammaCatStr
# Licensed under a 3-clause BSD style license - see LICENSE.rst


def test_gammacat_str():
    assert GammaCatStr.source_id_str(42) == '000042'

    meta = dict(source_id=42, reference_id='2015A&A...577A.131H')

# Path: gammacat/info.py
# class GammaCatStr:
#     """Make and parse strings (e.g. filenames).
#     """
# 
#     @staticmethod
#     def reference_folder(meta):
#         return GammaCatStr.reference_id_str(meta)
# 
#     @staticmethod
#     def data_filename(meta):
#         return GammaCatStr.reference_folder(meta['reference_id']) + \
#             '/tev-' + GammaCatStr.source_id_str(meta['source_id'])
# 
#     @staticmethod
#     def source_id_str(source_id):
#         return '{:06d}'.format(source_id)
# 
#     @staticmethod
#     def reference_id_str(reference_id):
#         return urllib.parse.quote(reference_id)


# Path: gammacat/tests/test_info.py
from gammacat.info import GammaCatStr

# Licensed under a 3-clause BSD style license - see LICENSE.rst


def test_gammacat_str():
    assert GammaCatStr.source_id_str(42) == '000042'

    meta = dict(source_id=42, reference_id='2015A&A...577A.131H')

    assert GammaCatStr.data_filename(meta) == '2015A%26A...577A.131H/tev-000042'