# Path: kubeface/naming.py
# JOB = Stringable(
#     "Job",
#     "{cache_key}::{node_id}::{randomness}")
# TASK = Stringable(
#     "Task",
#     "{cache_key}::{task_num:06d}")
# TASK_INPUT = Stringable(
#     "TaskInput",
#     "input::{task_name}")
# TASK_RESULT = Stringable(
#     "TaskResult",
#     "result::{task_name}+{attempt_num:d}+{queue_time}+{result_time}+"
#     "+{result_type}",
#     valid_values={
#         'result_type': ["value", "exception"],
#     })
# JOB_STATUS_PAGE = Stringable(
#     "JobStatusPage",
#     "{status}::{format}::{job_name}.{format}",
#     valid_values={
#         'format': ['html', 'json'],
#         'status': ['active', 'done'],
#     })
# REMOTE_OBJECT = Stringable(
#     "RemoteObject",
#     "object::{cache_key_prefix}::{node_id}::{object_num:d}-{randomness}")
# def hash_value(s, characters=8):
# def make_cache_key_prefix():
# def make_job_name(cache_key, node_id):
# def make_remote_object_name(cache_key_prefix, node_id, object_num):
# def task_result_prefix(cache_key, task_names=[]):
# def task_input_prefix(cache_key):
# def status_prefixes(job_names=None, formats=None, statuses=None):
# def sanitize(name):


from numpy import testing
from kubeface import naming



def test_basics():
    job = naming.JOB.make_string(
        cache_key="foo", node_id="node-master", randomness="123")
    print(job)
    testing.assert_equal(
        naming.JOB.make_string(naming.JOB.make_tuple(job)),
        job)
    testing.assert_equal(
        naming.JOB.prefix(cache_key=["foo"]),
        "foo::")
    testing.assert_equal(
        naming.JOB.prefix(cache_key=["foo", "fob"]),
        "fo")

    job_status = naming.JOB_STATUS_PAGE.make_string(
        format="json", status="active", job_name="foobar")
    testing.assert_equal(
        naming.JOB_STATUS_PAGE.make_string(

# Path: kubeface/naming.py
# JOB = Stringable(
#     "Job",
#     "{cache_key}::{node_id}::{randomness}")
# TASK = Stringable(
#     "Task",
#     "{cache_key}::{task_num:06d}")
# TASK_INPUT = Stringable(
#     "TaskInput",
#     "input::{task_name}")
# TASK_RESULT = Stringable(
#     "TaskResult",
#     "result::{task_name}+{attempt_num:d}+{queue_time}+{result_time}+"
#     "+{result_type}",
#     valid_values={
#         'result_type': ["value", "exception"],
#     })
# JOB_STATUS_PAGE = Stringable(
#     "JobStatusPage",
#     "{status}::{format}::{job_name}.{format}",
#     valid_values={
#         'format': ['html', 'json'],
#         'status': ['active', 'done'],
#     })
# REMOTE_OBJECT = Stringable(
#     "RemoteObject",
#     "object::{cache_key_prefix}::{node_id}::{object_num:d}-{randomness}")
# def hash_value(s, characters=8):
# def make_cache_key_prefix():
# def make_job_name(cache_key, node_id):
# def make_remote_object_name(cache_key_prefix, node_id, object_num):
# def task_result_prefix(cache_key, task_names=[]):
# def task_input_prefix(cache_key):
# def status_prefixes(job_names=None, formats=None, statuses=None):
# def sanitize(name):


# Path: tests/test_naming.py
from numpy import testing
from kubeface import naming




def test_basics():
    job = naming.JOB.make_string(
        cache_key="foo", node_id="node-master", randomness="123")
    print(job)
    testing.assert_equal(
        naming.JOB.make_string(naming.JOB.make_tuple(job)),
        job)
    testing.assert_equal(
        naming.JOB.prefix(cache_key=["foo"]),
        "foo::")
    testing.assert_equal(
        naming.JOB.prefix(cache_key=["foo", "fob"]),
        "fo")

    job_status = naming.JOB_STATUS_PAGE.make_string(
        format="json", status="active", job_name="foobar")
    testing.assert_equal(
        naming.JOB_STATUS_PAGE.make_string(

            naming.JOB_STATUS_PAGE.make_tuple(job_status)),