def test_symbol_factory(self):

        self.compare(wl.Map, b"Map")
        self.compare(wl.Map(wl.PrimeQ, (1, 2, 3)), b"Map[PrimeQ, {1, 2, 3}]")
        self.compare(wl.System.Map, b"System`Map")
        self.compare(wl.System.Symbol(1, 2), b"System`Symbol[1, 2]")
        self.compare(wl.This.Thing.Just.Works, b"This`Thing`Just`Works")
        self.compare(wl.This.Thing.Just.Works(1, 2), b"This`Thing`Just`Works[1, 2]")
Exemple #2
0
 def _(blk):
     blk.AllIDs = wl.Keys(serv.existingAccounts)
     blk.id = wl.ToString(
         If(
             wl.Not(wl.SameQ(wl.Length(blk.AllIDs), 0)),
             wl.Plus(wl.Max(wl.Map(wlexpr('ToExpression'), blk.AllIDs)),
                     1), 1))
     blk.existingAccounts[blk.id] = blk.dataUser
     blk.save_json(blk.coID, blk.existingAccounts)
     blk.accountData[blk.id] = wl.Association()
     blk.save_json(blk.coDATA, blk.accountData)
 def test_images_in_expr(self):
     img1_path = "hopper.ppm"
     img2_path = "pal1wb.bmp"
     with PIL.open(path_to_file_in_data_dir(img1_path)) as img1:
         with PIL.open(path_to_file_in_data_dir(img2_path)) as img2:
             res = self.kernel_session.evaluate(
                 wl.Map(wl.ImageDimensions, {"img1": img1, "img2": img2})
             )
             self.assertEqual(
                 res,
                 {
                     "img1": self.IMAGE_FILES_DIMS[img1_path],
                     "img2": self.IMAGE_FILES_DIMS[img2_path],
                 },
             )
 def test_wlexpr_wrapper(self):
     res = self.kernel_session.evaluate(wl.Map(wlexpr("#+1&"), [1, 2, 3]))
     self.assertEqual(res, (2, 3, 4))