Example #1
0
 def test__keyunwrap__1(self):
     docs = (tableclass(Document))()
     pages = (tableclass(Page))()
     dct = join_.JoinTypeDict()
     rel = junction_.Junction((docs,pages),('pages','doc'))
     self.assertIs(dct.__keyunwrap__(ref_.Ref(rel)), rel)
Example #2
0
 def test__gt_1(self):
     l = MyObj()
     r = MyObj()
     self.assertFalse(ref_.Ref(l) > ref_.Ref(l))
     self.assertFalse(ref_.Ref(r) > ref_.Ref(r))
     self.assertFalse(ref_.Ref(l) > l)
     self.assertFalse(ref_.Ref(r) > r)
     self.assertFalse(l > ref_.Ref(l))
     self.assertFalse(r > ref_.Ref(r))
     self.assertEqual(ref_.Ref(l) > ref_.Ref(r), id(l) > id(r))
     self.assertEqual(ref_.Ref(r) > ref_.Ref(l), id(r) > id(l))
     self.assertEqual(ref_.Ref(l) > r, id(l) > id(r))
     self.assertEqual(ref_.Ref(r) > l, id(r) > id(l))
     self.assertEqual(l > ref_.Ref(r), id(l) > id(r))
     self.assertEqual(r > ref_.Ref(l), id(r) > id(l))
Example #3
0
 def test__le_1(self):
     l = MyObj()
     r = MyObj()
     self.assertTrue(ref_.Ref(l) <= ref_.Ref(l))
     self.assertTrue(ref_.Ref(r) <= ref_.Ref(r))
     self.assertTrue(ref_.Ref(l) <= l)
     self.assertTrue(ref_.Ref(r) <= r)
     self.assertTrue(l <= ref_.Ref(l))
     self.assertTrue(r <= ref_.Ref(r))
     self.assertEqual(ref_.Ref(l) <= ref_.Ref(r), id(l) <= id(r))
     self.assertEqual(ref_.Ref(r) <= ref_.Ref(l), id(r) <= id(l))
     self.assertEqual(ref_.Ref(l) <= r, id(l) <= id(r))
     self.assertEqual(ref_.Ref(r) <= l, id(r) <= id(l))
     self.assertEqual(l <= ref_.Ref(r), id(l) <= id(r))
     self.assertEqual(r <= ref_.Ref(l), id(r) <= id(l))
Example #4
0
 def test__ne_1(self):
     l = MyObj()
     r = MyObj()
     self.assertFalse(ref_.Ref(l) != ref_.Ref(l))
     self.assertFalse(ref_.Ref(r) != ref_.Ref(r))
     self.assertFalse(ref_.Ref(l) != l)
     self.assertFalse(ref_.Ref(r) != r)
     self.assertFalse(l != ref_.Ref(l))
     self.assertFalse(r != ref_.Ref(r))
     self.assertTrue(ref_.Ref(l) != ref_.Ref(r))
     self.assertTrue(ref_.Ref(r) != ref_.Ref(l))
     self.assertTrue(ref_.Ref(l) != r)
     self.assertTrue(ref_.Ref(r) != l)
     self.assertTrue(l != ref_.Ref(r))
     self.assertTrue(r != ref_.Ref(l))
Example #5
0
 def test__lt_1(self):
     l = MyObj()
     r = MyObj()
     self.assertFalse(ref_.Ref(l) < ref_.Ref(l))
     self.assertFalse(ref_.Ref(r) < ref_.Ref(r))
     self.assertFalse(ref_.Ref(l) < l)
     self.assertFalse(ref_.Ref(r) < r)
     self.assertFalse(l < ref_.Ref(l))
     self.assertFalse(r < ref_.Ref(r))
     self.assertEqual(ref_.Ref(l) < ref_.Ref(r), id(l) < id(r))
     self.assertEqual(ref_.Ref(r) < ref_.Ref(l), id(r) < id(l))
     self.assertEqual(ref_.Ref(l) < r, id(l) < id(r))
     self.assertEqual(ref_.Ref(r) < l, id(r) < id(l))
     self.assertEqual(l < ref_.Ref(r), id(l) < id(r))
     self.assertEqual(r < ref_.Ref(l), id(r) < id(l))
Example #6
0
 def test__eq_1(self):
     l = MyObj()
     r = MyObj()
     self.assertTrue(ref_.Ref(l) == ref_.Ref(l))
     self.assertTrue(ref_.Ref(r) == ref_.Ref(r))
     self.assertTrue(ref_.Ref(l) == l)
     self.assertTrue(ref_.Ref(r) == r)
     self.assertTrue(l == ref_.Ref(l))
     self.assertTrue(r == ref_.Ref(r))
     self.assertFalse(ref_.Ref(l) == ref_.Ref(r))
     self.assertFalse(ref_.Ref(r) == ref_.Ref(l))
     self.assertFalse(ref_.Ref(l) == r)
     self.assertFalse(ref_.Ref(r) == l)
     self.assertFalse(l == ref_.Ref(r))
     self.assertFalse(r == ref_.Ref(l))
Example #7
0
 def test__hash_1(self):
     o = MyObj()
     r = ref_.Ref(o)
     self.assertEqual(hash(r), hash(id(o)))
Example #8
0
 def test__obj_setter_1(self):
     r = ref_.Ref(MyObj())
     with self.assertRaisesRegex(AttributeError, r"can't set attribute"):
         r.obj = 'asdf'
Example #9
0
 def test__obj_1(self):
     o = MyObj()
     r = ref_.Ref(o)
     self.assertIs(r.obj, o)
Example #10
0
 def test__ge_1(self):
     l = MyObj()
     r = MyObj()
     self.assertTrue(ref_.Ref(l) >= ref_.Ref(l))
     self.assertTrue(ref_.Ref(r) >= ref_.Ref(r))
     self.assertTrue(ref_.Ref(l) >= l)
     self.assertTrue(ref_.Ref(r) >= r)
     self.assertTrue(l >= ref_.Ref(l))
     self.assertTrue(r >= ref_.Ref(r))
     self.assertEqual(ref_.Ref(l) >= ref_.Ref(r), id(l) >= id(r))
     self.assertEqual(ref_.Ref(r) >= ref_.Ref(l), id(r) >= id(l))
     self.assertEqual(ref_.Ref(l) >= r, id(l) >= id(r))
     self.assertEqual(ref_.Ref(r) >= l, id(r) >= id(l))
     self.assertEqual(l >= ref_.Ref(r), id(l) >= id(r))
     self.assertEqual(r >= ref_.Ref(l), id(r) >= id(l))