Example #1
0
 @Test
 public void testDatatypeMutability() throws Exception {
   assertTrue(EvalUtils.isImmutable("foo"));
   assertTrue(EvalUtils.isImmutable(3));
   assertTrue(EvalUtils.isImmutable(Tuple.of(1, 2, 3)));
   assertFalse(EvalUtils.isImmutable(MutableList.of(null, 1, 2, 3)));
   assertFalse(EvalUtils.isImmutable(makeDict()));
 }
Example #2
0
 @Test
 public void testDataTypeNames() throws Exception {
   assertEquals("string", EvalUtils.getDataTypeName("foo"));
   assertEquals("int", EvalUtils.getDataTypeName(3));
   assertEquals("tuple", EvalUtils.getDataTypeName(Tuple.of(1, 2, 3)));
   assertEquals("list", EvalUtils.getDataTypeName(MutableList.of(null, 1, 2, 3)));
   assertEquals("dict", EvalUtils.getDataTypeName(makeDict()));
   assertEquals("NoneType", EvalUtils.getDataTypeName(Runtime.NONE));
 }