# Path: cjktools/resources/place.py
# class Place(dict):
#     def __init__(self, label, reading=None, aliases=None):
#     def get_children(self):
#     def __repr__(self):
#     def __str__(self):
#     def dump(self, filename):
#     def from_file(cls, filename):
#     def append(self, node):
#     def find_node(self, label):
#     def find_all(self, label):
#     def walk(self):
#     def walk_with_path(self):
#     def _to_line(self, depth):
#     def _from_line(line):


import unittest
import os
import tempfile
from cjktools.resources import place
def suite():
    test_suite = unittest.TestSuite((
        unittest.makeSuite(PlaceTestCase)
    ))
    return test_suite


class PlaceTestCase(unittest.TestCase):
    def setUp(self):
        self.melb = place.Place('Melbourne', 'メルボルン')
        self.aust = place.Place('Australia', 'オーストラリア')
        tmpfile, self.filename = tempfile.mkstemp()
        os.close(tmpfile)

    def test_basics(self):
        self.assertEqual(self.melb.label, 'Melbourne')
        self.assertEqual(self.melb.reading, 'メルボルン')

        self.aust.append(self.melb)

        self.assertIn(self.melb.label, self.aust)

    def test_formatting(self):
        original_place = self.aust
        melbourne = self.melb
        melbourne.append(place.Place('St_Kilda', 'セーントキルダ'))
        melbourne.append(place.Place('Collingwood', 'コーリングウード'))
        original_place.append(melbourne)

        sydney = place.Place('Sydney', 'シドニー')

# Path: cjktools/resources/place.py
# class Place(dict):
#     def __init__(self, label, reading=None, aliases=None):
#     def get_children(self):
#     def __repr__(self):
#     def __str__(self):
#     def dump(self, filename):
#     def from_file(cls, filename):
#     def append(self, node):
#     def find_node(self, label):
#     def find_all(self, label):
#     def walk(self):
#     def walk_with_path(self):
#     def _to_line(self, depth):
#     def _from_line(line):


# Path: cjktools/tests/resources/test_place.py
import unittest
import os
import tempfile
from cjktools.resources import place

def suite():
    test_suite = unittest.TestSuite((
        unittest.makeSuite(PlaceTestCase)
    ))
    return test_suite


class PlaceTestCase(unittest.TestCase):
    def setUp(self):
        self.melb = place.Place('Melbourne', 'メルボルン')
        self.aust = place.Place('Australia', 'オーストラリア')
        tmpfile, self.filename = tempfile.mkstemp()
        os.close(tmpfile)

    def test_basics(self):
        self.assertEqual(self.melb.label, 'Melbourne')
        self.assertEqual(self.melb.reading, 'メルボルン')

        self.aust.append(self.melb)

        self.assertIn(self.melb.label, self.aust)

    def test_formatting(self):
        original_place = self.aust
        melbourne = self.melb
        melbourne.append(place.Place('St_Kilda', 'セーントキルダ'))
        melbourne.append(place.Place('Collingwood', 'コーリングウード'))
        original_place.append(melbourne)

        sydney = place.Place('Sydney', 'シドニー')

        self.assertRaises(ValueError, place.Place, "Anja's place")