# Path: betago/gosgf/sgf_properties.py
#     def identity(x):
# def normalise_charset_name(s):
# def interpret_go_point(s, size):
# def serialise_go_point(move, size):
#     def __init__(self, size, encoding):
# def interpret_none(s, context=None):
# def serialise_none(b, context=None):
# def interpret_number(s, context=None):
# def serialise_number(i, context=None):
# def interpret_real(s, context=None):
# def serialise_real(f, context=None):
# def interpret_double(s, context=None):
# def serialise_double(i, context=None):
# def interpret_colour(s, context=None):
# def serialise_colour(colour, context=None):
# def _transcode(s, encoding):
# def interpret_simpletext(s, context):
# def serialise_simpletext(s, context):
# def interpret_text(s, context):
# def serialise_text(s, context):
# def interpret_point(s, context):
# def serialise_point(point, context):
# def interpret_move(s, context):
# def serialise_move(move, context):
# def interpret_point_list(values, context):
# def serialise_point_list(points, context):
# def interpret_AP(s, context):
# def serialise_AP(value, context):
# def interpret_ARLN_list(values, context):
# def serialise_ARLN_list(values, context):
# def interpret_FG(s, context):
# def serialise_FG(value, context):
# def interpret_LB_list(values, context):
# def serialise_LB_list(values, context):
#     def __init__(self, interpreter, serialiser, uses_list,
#                  allows_empty_list=False):
# def _make_property_type(type_name, allows_empty_list=False):
#     def __init__(self, size, encoding):
#     def get_property_type(self, identifier):
#     def register_property(self, identifier, property_type):
#     def deregister_property(self, identifier):
#     def set_private_property_type(self, property_type):
#     def _get_effective_property_type(self, identifier):
#     def interpret_as_type(self, property_type, raw_values):
#     def interpret(self, identifier, raw_values):
#     def serialise_as_type(self, property_type, value):
#     def serialise(self, identifier, value):
# class _Context(object):
# class Property_type(object):
# class Presenter(_Context):
# P = _property_types_by_name


import unittest
from textwrap import dedent
from betago.gosgf import sgf_properties
                         u.encode("utf-8"))
        self.assertRaises(UnicodeDecodeError, interpret,
                          u.encode("iso-8859-1"), "UTF-8")
        self.assertRaises(UnicodeDecodeError, interpret, u.encode("utf-8"), "ASCII")

    def test_serialise_text(self):
        def serialise(s, encoding):
            context = sgf_properties._Context(19, encoding)
            return sgf_properties.serialise_text(s, context)
        self.assertEqual(serialise(b"ab\\c", "utf-8"), b"ab\\\\c")
        u = u"test \N{POUND SIGN}"
        self.assertEqual(serialise(u.encode("utf-8"), "UTF-8"),
                         u.encode("utf-8"))
        self.assertEqual(serialise(u.encode("utf-8"), "ISO-8859-1"),
                         u.encode("iso-8859-1"))
        self.assertRaises(UnicodeEncodeError, serialise,
                          u"\N{EN DASH}".encode("utf-8"), "ISO-8859-1")

    def test_interpret_number(self):
        interpret_number = sgf_properties.interpret_number
        self.assertEqual(interpret_number("1"), 1)
        self.assertIs(type(interpret_number("1")), int)
        self.assertEqual(interpret_number("0"), 0)
        self.assertEqual(interpret_number("-1"), -1)
        self.assertEqual(interpret_number("+1"), 1)
        self.assertRaises(ValueError, interpret_number, "1.5")
        self.assertRaises(ValueError, interpret_number, "0xaf")
        self.assertRaises(TypeError, interpret_number, 1)

    def test_interpret_real(self):

# Path: betago/gosgf/sgf_properties.py
#     def identity(x):
# def normalise_charset_name(s):
# def interpret_go_point(s, size):
# def serialise_go_point(move, size):
#     def __init__(self, size, encoding):
# def interpret_none(s, context=None):
# def serialise_none(b, context=None):
# def interpret_number(s, context=None):
# def serialise_number(i, context=None):
# def interpret_real(s, context=None):
# def serialise_real(f, context=None):
# def interpret_double(s, context=None):
# def serialise_double(i, context=None):
# def interpret_colour(s, context=None):
# def serialise_colour(colour, context=None):
# def _transcode(s, encoding):
# def interpret_simpletext(s, context):
# def serialise_simpletext(s, context):
# def interpret_text(s, context):
# def serialise_text(s, context):
# def interpret_point(s, context):
# def serialise_point(point, context):
# def interpret_move(s, context):
# def serialise_move(move, context):
# def interpret_point_list(values, context):
# def serialise_point_list(points, context):
# def interpret_AP(s, context):
# def serialise_AP(value, context):
# def interpret_ARLN_list(values, context):
# def serialise_ARLN_list(values, context):
# def interpret_FG(s, context):
# def serialise_FG(value, context):
# def interpret_LB_list(values, context):
# def serialise_LB_list(values, context):
#     def __init__(self, interpreter, serialiser, uses_list,
#                  allows_empty_list=False):
# def _make_property_type(type_name, allows_empty_list=False):
#     def __init__(self, size, encoding):
#     def get_property_type(self, identifier):
#     def register_property(self, identifier, property_type):
#     def deregister_property(self, identifier):
#     def set_private_property_type(self, property_type):
#     def _get_effective_property_type(self, identifier):
#     def interpret_as_type(self, property_type, raw_values):
#     def interpret(self, identifier, raw_values):
#     def serialise_as_type(self, property_type, value):
#     def serialise(self, identifier, value):
# class _Context(object):
# class Property_type(object):
# class Presenter(_Context):
# P = _property_types_by_name


# Path: tests/gosgf/sgf_properties_test.py
import unittest
from textwrap import dedent
from betago.gosgf import sgf_properties

                         u.encode("utf-8"))
        self.assertRaises(UnicodeDecodeError, interpret,
                          u.encode("iso-8859-1"), "UTF-8")
        self.assertRaises(UnicodeDecodeError, interpret, u.encode("utf-8"), "ASCII")

    def test_serialise_text(self):
        def serialise(s, encoding):
            context = sgf_properties._Context(19, encoding)
            return sgf_properties.serialise_text(s, context)
        self.assertEqual(serialise(b"ab\\c", "utf-8"), b"ab\\\\c")
        u = u"test \N{POUND SIGN}"
        self.assertEqual(serialise(u.encode("utf-8"), "UTF-8"),
                         u.encode("utf-8"))
        self.assertEqual(serialise(u.encode("utf-8"), "ISO-8859-1"),
                         u.encode("iso-8859-1"))
        self.assertRaises(UnicodeEncodeError, serialise,
                          u"\N{EN DASH}".encode("utf-8"), "ISO-8859-1")

    def test_interpret_number(self):
        interpret_number = sgf_properties.interpret_number
        self.assertEqual(interpret_number("1"), 1)
        self.assertIs(type(interpret_number("1")), int)
        self.assertEqual(interpret_number("0"), 0)
        self.assertEqual(interpret_number("-1"), -1)
        self.assertEqual(interpret_number("+1"), 1)
        self.assertRaises(ValueError, interpret_number, "1.5")
        self.assertRaises(ValueError, interpret_number, "0xaf")
        self.assertRaises(TypeError, interpret_number, 1)

    def test_interpret_real(self):

        interpret_real = sgf_properties.interpret_real