示例#1
0
 def test_bug_convert_empty_mapping(self):
     """bug #8 : empty mapping intialisation dont work"""
     bug = bowyer( Hankyu,dict( a={}))
     expected = Hankyu( {'a': {}})
     self.assertEqual(
         expected,
         bug
     )
示例#2
0
 def setUp(self):
     self.easy = Daikyu( x=1, y=1, z=0)
     self.easy_too = Daikyu( x=0, y=-2, o=0)
     
     self.a_tree = dict(
         a = 1,
         b = dict(
             c = 3.0,
             d = dict(e=True)
         ),
         point = self.easy
     )
     self.cplx = bowyer(Daikyu,self.a_tree)
示例#3
0
 def test_convert(self):
     self.assertEqual(
         bowyer(Hankyu, {'a': {'b': 1}}),
         Hankyu( {'a': Hankyu(b=1)})
         )
示例#4
0
#/usr/bin/env python
import os
import sys

import unittest
from  archery.bow import Daikyu as VectorDict
from archery.barrack import bowyer
conv = lambda tree: VectorDict(int, tree)
convert_tree = lambda tree: bowyer(conv, tree)

from math import sqrt


class TestPath(unittest.TestCase):
    def setUp(self):
        self.a_path = Path(range(10))

    def test_build(self):
        self.assertEqual(
            self.a_path,
            (0, 1, 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9)
        )

    def test_startswith(self):
        self.assertEqual(
            self.a_path.startswith(0, 1 , 2),
            True
        )

    def test_endswith(self):
        self.assertEqual(