示例#1
0
 def list2(obj):
     check_type(List( [[int]] ), obj)
示例#2
0
 def list3(obj):
     check_type(List( (int, float) ), obj)
示例#3
0
 def list1(obj):
     check_type(List( [int] ), obj)
示例#4
0
 def test_hash(self):
     from typecheck import List
     
     class A(object): pass
     class B(A): pass
     
     eq_tests = [
         (List(str, str), List(str, str)),
         (List(A, B), List(A, B)),
         (List(List(int, int), int), List(List(int, int), int)) ]
         
     ne_tests = [
         (List(str, int), List(int, str)),
         (List(A, B), List(B, B)),
         (List(A, B), List(A, A)),
         (List(), List(int, int)),
         (List(List(int, int)), List(List(List(int, int)))),
         (List(int, int), List(int, int, int)) ]
     
     test_hash(eq_tests, ne_tests)
示例#5
0
 def lis(obj):
     check_type(List(int, float), obj)
示例#6
0
 def test_equality(self):
     from typecheck import List
     
     class A(object): pass
     class B(A): pass
     
     eq_tests = [
         (List(str), List(str)),
         (List(A), List(A)),
         (List(), List()),
         (List(List(int)), List(List(int))) ]
         
     ne_tests = [
         (List(str), List(int)),
         (List(A), List(B)),
         (List(), List(int)),
         (List(List(int)), List(List(List(int)))),
         (List(int), List(int, int)),
         (List(int), [int]) ]
     
     test_equality(eq_tests, ne_tests)
示例#7
0
    def test_hash(self):
        from typecheck import List

        class A(object):
            pass

        class B(A):
            pass

        eq_tests = [(List(str), List(str)), (List(A), List(A)),
                    (List(List(int)), List(List(int)))]

        ne_tests = [(List(str), List(int)), (List(A), List(B)),
                    (List(List(int)), List(List(List(int))))]

        self.multipleAssertEqualHashes(eq_tests, ne_tests)