# Path: dsenser/constants.py
# CONNECTIVE = "Connective"
# 
# TOK_LIST = "TokenList"
# 
# Path: dsenser/utils.py
# def singleton(cls):
#     """Make `cls` instance unique across all calls.
# 
#     Args:
#       cls (class):
#         class to be decorated
# 
#     Retuns:
#       object:
#         singleton instance of the decorated class
# 
#     """
#     instance = cls()
#     instance.__call__ = lambda: instance
#     return instance
# 
# def is_explicit(a_rel):
#     """Check whether given relation is explicit.
# 
#     Args:
#       a_rel (dict):
#        discourse relation to classify
# 
#     Returns:
#       bool:
#         ``True`` if the relation is explicit, ``False`` otherwise
# 
#     """
#     return bool(a_rel[CONNECTIVE][TOK_LIST])


from dsenser.constants import CONNECTIVE, TOK_LIST
from dsenser.utils import singleton, is_explicit
#!/usr/bin/env python
# -*- coding: utf-8; mode: python; -*-

##################################################################
# Imports
from __future__ import absolute_import



##################################################################
# Auxiliary Class
@singleton
class Aux(object):
    m1 = 3


##################################################################
# Test Classes
def test_singleton():
    a1 = Aux
    a2 = Aux
    assert a1.m1 == 3
    assert a2.m1 == 3
    assert a1 is a2


def test_is_explicit():
    assert is_explicit({CONNECTIVE: {TOK_LIST: [1, 2, 3]}})

# Path: dsenser/constants.py
# CONNECTIVE = "Connective"
# 
# TOK_LIST = "TokenList"
# 
# Path: dsenser/utils.py
# def singleton(cls):
#     """Make `cls` instance unique across all calls.
# 
#     Args:
#       cls (class):
#         class to be decorated
# 
#     Retuns:
#       object:
#         singleton instance of the decorated class
# 
#     """
#     instance = cls()
#     instance.__call__ = lambda: instance
#     return instance
# 
# def is_explicit(a_rel):
#     """Check whether given relation is explicit.
# 
#     Args:
#       a_rel (dict):
#        discourse relation to classify
# 
#     Returns:
#       bool:
#         ``True`` if the relation is explicit, ``False`` otherwise
# 
#     """
#     return bool(a_rel[CONNECTIVE][TOK_LIST])


# Path: tests/test_utils.py
from dsenser.constants import CONNECTIVE, TOK_LIST
from dsenser.utils import singleton, is_explicit

#!/usr/bin/env python
# -*- coding: utf-8; mode: python; -*-

##################################################################
# Imports
from __future__ import absolute_import



##################################################################
# Auxiliary Class
@singleton
class Aux(object):
    m1 = 3


##################################################################
# Test Classes
def test_singleton():
    a1 = Aux
    a2 = Aux
    assert a1.m1 == 3
    assert a2.m1 == 3
    assert a1 is a2


def test_is_explicit():
    assert is_explicit({CONNECTIVE: {TOK_LIST: [1, 2, 3]}})

    assert is_explicit({CONNECTIVE: {TOK_LIST: []}}) is False