예제 #1
0
 def testHashEqual(self):
     d = monteSet()
     d[IntObject(42)] = None
     d[CharObject(u'¡')] = None
     a = ConstSet(d)
     b = ConstSet(d)
     self.assertEqual(a.hash(), b.hash())
예제 #2
0
파일: test_data.py 프로젝트: washort/typhon
 def testNext(self):
     c = CharObject(u'c')
     result = c.call(u"next", [])
     self.assertEqual(result._c, u'd')
예제 #3
0
파일: test_data.py 프로젝트: washort/typhon
 def testCategorySymbol(self):
     c = CharObject(u'¢')
     result = c.call(u"getCategory", [])
     self.assertEqual(result._s, u"Sc")
예제 #4
0
파일: test_data.py 프로젝트: washort/typhon
 def testAdd(self):
     c = CharObject(u'c')
     result = c.call(u"add", [IntObject(2)])
     self.assertEqual(result._c, u'e')
예제 #5
0
 def testHashInequalItems(self):
     a = ConstList([IntObject(42), CharObject(u'é')])
     b = ConstList([IntObject(42), CharObject(u'e')])
     self.assertNotEqual(a.hash(), b.hash())
예제 #6
0
 def testHashInequal(self):
     a = CharObject(u'a')
     b = CharObject(u'b')
     self.assertNotEqual(a.hash(), b.hash())
예제 #7
0
 def testContains(self):
     l = FlexList([IntObject(5), CharObject(u'a')])
     self.assertTrue(l.contains(IntObject(5)))
     self.assertFalse(l.contains(IntObject(42)))
     self.assertFalse(l.contains(l))
예제 #8
0
 def testHashInequalItems(self):
     a = wrapList([IntObject(42), CharObject(u'é')])
     b = wrapList([IntObject(42), CharObject(u'e')])
     self.assertNotEqual(a.samenessHash(), b.samenessHash())
예제 #9
0
 def testCharEquality(self):
     first = CharObject(u'c')
     second = CharObject(u'c')
     self.assertEqual(optSame(first, second), EQUAL)
예제 #10
0
파일: mix.py 프로젝트: zarutian/typhon
 def visitCharExpr(self, c, span):
     return self.dest.LiveExpr(CharObject(c), span)
예제 #11
0
 def testHashEqual(self):
     a = wrapList([IntObject(42), CharObject(u'é')])
     b = wrapList([IntObject(42), CharObject(u'é')])
     self.assertEqual(a.samenessHash(), b.samenessHash())
예제 #12
0
파일: nodes.py 프로젝트: zarutian/typhon
 def uncall(self):
     return wrapList([CharObject(self._c)])
예제 #13
0
파일: test_data.py 프로젝트: dckc/typhon
 def testHashEqual(self):
     a = CharObject(u'a')
     b = CharObject(u'a')
     self.assertEqual(a.samenessHash(), b.samenessHash())
예제 #14
0
파일: test_data.py 프로젝트: dckc/typhon
 def testMax(self):
     c = CharObject(u'c')
     d = CharObject(u'd')
     result = c.call(u"max", [d])
     self.assertEqual(result.getChar(), d.getChar())
예제 #15
0
파일: test_data.py 프로젝트: washort/typhon
 def testHashInequal(self):
     a = CharObject(u'a')
     b = CharObject(u'b')
     self.assertNotEqual(a.hash(), b.hash())
예제 #16
0
 def testMax(self):
     c = CharObject(u'c')
     d = CharObject(u'd')
     result = c.call(u"max", [d])
     self.assertEqual(result.getChar(), d.getChar())
예제 #17
0
 def wrap(self, value):
     return CharObject(value)
예제 #18
0
 def testHashEqual(self):
     a = CharObject(u'a')
     b = CharObject(u'a')
     self.assertEqual(a.samenessHash(), b.samenessHash())
예제 #19
0
 def testQuoteSlashes(self):
     c = CharObject(u'\\')
     result = c.call(u"quote", [])
     self.assertEqual(result._s, u"'\\\\'")
예제 #20
0
파일: lists.py 프로젝트: zarutian/typhon
        def default_value(self):
            return exemplar

    return UnboxedListStrategy


def unboxUnconnectedRef(value):
    assert isinstance(value, UnconnectedRef), "Implementation detail"
    return value._problem


unboxedStrategies = [
    makeUnboxedListStrategy(cls, box, unbox, exemplar)
    for (cls, box, unbox, exemplar) in [
        # Chars.
        (CharObject, CharObject, unwrapChar, CharObject(u'▲')),
        # Small ints.
        (IntObject, IntObject, unwrapInt, IntObject(42)),
        # Unicode strings.
        (StrObject, StrObject, unwrapStr, StrObject(u"▲")),
        # Bytestrings.
        (BytesObject, BytesObject, unwrapBytes, BytesObject("M")),
        # _booleanFlow-generated lists of unconnected refs.
        (UnconnectedRef, UnconnectedRef, unboxUnconnectedRef,
         UnconnectedRef(StrObject(u"Implementation detail leaked"))),
    ]
]


@rstrategies.strategy(generalize=[NullListStrategy] + unboxedStrategies +
                      [GenericListStrategy])
예제 #21
0
 def testPutSize(self):
     l = FlexList([IntObject(5), CharObject(u'a')])
     l.put(1, IntObject(7))
     expected = [IntObject(5), IntObject(7)]
     self.assertEqual(l.strategy.size(l), len(expected))
예제 #22
0
 def testAdd(self):
     c = CharObject(u'c')
     result = c.call(u"add", [IntObject(2)])
     self.assertEqual(result._c, u'e')
예제 #23
0
 def testHashEqual(self):
     a = ConstList([IntObject(42), CharObject(u'é')])
     b = ConstList([IntObject(42), CharObject(u'é')])
     self.assertEqual(a.hash(), b.hash())
예제 #24
0
 def testCategoryUnicode(self):
     c = CharObject(u'č')
     result = c.call(u"getCategory", [])
     self.assertEqual(result._s, u"Ll")
예제 #25
0
 def testPopManyHeterogenous(self):
     l = FlexList([CharObject(u'm'), IntObject(5)])
     result = l.call(u"pop", [])
     self.assertEqual(result.getInt(), 5)
예제 #26
0
 def testCategorySymbol(self):
     c = CharObject(u'¢')
     result = c.call(u"getCategory", [])
     self.assertEqual(result._s, u"Sc")
예제 #27
0
파일: test_data.py 프로젝트: washort/typhon
 def testCategoryUnicode(self):
     c = CharObject(u'č')
     result = c.call(u"getCategory", [])
     self.assertEqual(result._s, u"Ll")
예제 #28
0
 def testMax(self):
     c = CharObject(u'c')
     d = CharObject(u'd')
     result = c.call(u"max", [d])
     self.assertTrue(result is d)
예제 #29
0
파일: test_data.py 프로젝트: washort/typhon
 def testMax(self):
     c = CharObject(u'c')
     d = CharObject(u'd')
     result = c.call(u"max", [d])
     self.assertTrue(result is d)
예제 #30
0
 def testNext(self):
     c = CharObject(u'c')
     result = c.call(u"next", [])
     self.assertEqual(result._c, u'd')
예제 #31
0
파일: test_data.py 프로젝트: washort/typhon
 def testNextUnicode(self):
     c = CharObject(u'¡')
     result = c.call(u"next", [])
     self.assertEqual(result._c, u'¢')
예제 #32
0
 def testNextUnicode(self):
     c = CharObject(u'¡')
     result = c.call(u"next", [])
     self.assertEqual(result._c, u'¢')
예제 #33
0
파일: test_data.py 프로젝트: washort/typhon
 def testQuoteSlashes(self):
     c = CharObject(u'\\')
     result = c.call(u"quote", [])
     self.assertEqual(result._s, u"'\\\\'")
예제 #34
0
 def default_value(self):
     return CharObject(u'▲')