예제 #1
0
 def test_put2(self):
     sv = StructValue(self._mt1)
     sv.put(self._mf1, None)
     sv.put(self._mf2, None)
     sv.put(self._mf3, None)
     sv.put(self._mf4, None)
     sv.put(self._mf5, None)
     sv.put(self._mf6, None)
     self.assertEqual(0, sv.size())
예제 #2
0
    def test_isType(self):
        sv = StructValue(self._mt1)
        self.assertEqual(True, sv.isType(self._mt1))
        self.assertEqual(False, sv.isType(self._mt2))

        sv = StructValue(self._mt2)
        self.assertEqual(True, sv.isType(self._mt2))
        self.assertEqual(False, sv.isType(self._mt1))
예제 #3
0
 def test_importCustomValue_Unknown(self):
     sv = StructValue(self.vf.getType("x"))
     self.assertEquals(None, self.vf.importCustomValue(sv))
예제 #4
0
 def test_importCustomValue_Etch_RuntimeException_msg(self):
     sv = StructValue(self.vf.getType("_Etch_RuntimeException"))
     sv.put(DefaultValueFactory._mf_msg, "foo")
     e = self.vf.importCustomValue(sv)
     self.assertNotEquals(None, e)
     self.assertEquals("foo", e.msg)
예제 #5
0
 def test_importCustomValue_Etch_RuntimeException(self):
     sv = StructValue(self.vf.getType("_Etch_RuntimeException"))
     e = self.vf.importCustomValue(sv)
     self.assertNotEquals(None, e)
     self.assertEquals(None, e.msg)
예제 #6
0
 def test_checkType1(self):
     StructValue(self._mt1).checkType(self._mt1)
     StructValue(self._mt2).checkType(self._mt2)
예제 #7
0
    def test_getType(self):
        sv = StructValue(self._mt1)
        self.assertEqual(self._mt1, sv.type())

        sv = StructValue(self._mt2)
        self.assertEqual(self._mt2, sv.type())
예제 #8
0
    def test_toString(self):

        sv = StructValue(self._mt1)
        self.assertEquals("one(785945377): {}", repr(sv))

        sv = StructValue(self._mt2)
        self.assertEquals("two(827843303): {}", repr(sv))

        sv = StructValue(self._mt1)
        sv.put(self._mf1, True)
        self.assertEquals("one(785945377): {f1(1512176592): True}", repr(sv))

        sv = StructValue(self._mt1)
        sv.put(self._mf3, 23)
        self.assertEquals("one(785945377): {f3(1512176594): 23}", repr(sv))

        sv = StructValue(self._mt1)
        sv.put(self._mf1, False)
        sv.put(self._mf3, 74)
        self.assertEqual(True, "one(785945377): {f1(1512176592): False, f3(1512176594): 74}" == repr(sv) or "one(785945377): {f3(1512176594): 74, f1(1512176592): False}" == repr(sv) )
예제 #9
0
 def test_put15(self):
     sv = StructValue(self._mt1)
     self.assertRaises(IllegalArgumentException, sv.put, self._mf2, [[]])
예제 #10
0
 def test_put12(self):
     sv = StructValue(self._mt1)
     sv.put(self._mf2, None)
예제 #11
0
 def test_put10(self):
     sv = StructValue(self._mt1)
     self.assertRaises(IllegalArgumentException, sv.put, self._mf1, Float(1.2))
예제 #12
0
 def test_put6(self):
     sv = StructValue(self._mt1)
     self.assertRaises(IllegalArgumentException, sv.put, self._mf1, Short(1))
예제 #13
0
 def test_put3(self):
     sv = StructValue(self._mt1)
     sv.put(self._mf1, False)
     sv.put(self._mf2, [True, False])
     sv.put(self._mf3, 1)
     sv.put(self._mf4, [1,2])
     sv.put(self._mf5, "a")
     sv.put(self._mf6, ["a", "b"])
     self.assertEqual(6, sv.size())
     
     # Now remove them
     sv.put(self._mf1, None)
     sv.put(self._mf2, None)
     sv.put(self._mf3, None)
     sv.put(self._mf4, None)
     sv.put(self._mf5, None)
     sv.put(self._mf6, None)
     self.assertEqual(0, sv.size())
예제 #14
0
 def test_put1(self):
     sv = StructValue(self._mt1)
     sv.put(self._mf1, False)
     sv.put(self._mf2, [True, False])
     sv.put(self._mf3, 1)
     sv.put(self._mf4, [1,2])
     sv.put(self._mf5, "a")
     sv.put(self._mf6, ["a", "b"])
     self.assertEqual(6, sv.size())
예제 #15
0
    def test_remove(self):
        sv = StructValue(self._mt1)
        self.assertEqual(True, sv.isEmpty())
        self.assertEqual(0, sv.size())
        self.assertEqual(None, sv.get(self._mf1))

        sv.remove(self._mf1)
        self.assertEqual(True, sv.isEmpty())
        self.assertEqual(0, sv.size())
        self.assertEqual(None, sv.get(self._mf1))

        sv.put(self._mf1, True)
        self.assertEqual(False, sv.isEmpty())
        self.assertEqual(1, sv.size())
        self.assertEqual(True, sv.get(self._mf1))

        sv.remove(self._mf1)
        self.assertEqual(True, sv.isEmpty())
        self.assertEqual(0, sv.size())
        self.assertEqual(None, sv.get(self._mf1))

        sv.remove(self._mf1)
        self.assertEqual(True, sv.isEmpty())
        self.assertEqual(0, sv.size())
        self.assertEqual(None, sv.get(self._mf1))
예제 #16
0
 def test_checkType3(self):
     self.assertRaises(IllegalArgumentException, StructValue(self._mt2).checkType, self._mt1)