Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
intersection.test.ts111 linesDownload Raw Back to tests
1// @ts-ignore TS61332import { expect, test } from "vitest";3 4import * as z from "zod/v3";5 6test("object intersection", () => {7  const BaseTeacher = z.object({8    subjects: z.array(z.string()),9  });10  const HasID = z.object({ id: z.string() });11 12  const Teacher = z.intersection(BaseTeacher.passthrough(), HasID); // BaseTeacher.merge(HasID);13  const data = {14    subjects: ["math"],15    id: "asdfasdf",16  };17  expect(Teacher.parse(data)).toEqual(data);18  expect(() => Teacher.parse({ subject: data.subjects })).toThrow();19  expect(Teacher.parse({ ...data, extra: 12 })).toEqual({ ...data, extra: 12 });20 21  expect(() => z.intersection(BaseTeacher.strict(), HasID).parse({ ...data, extra: 12 })).toThrow();22});23 24test("deep intersection", () => {25  const Animal = z.object({26    properties: z.object({27      is_animal: z.boolean(),28    }),29  });30  const Cat = z31    .object({32      properties: z.object({33        jumped: z.boolean(),34      }),35    })36    .and(Animal);37 38  type _Cat = z.infer<typeof Cat>;39  // const cat:Cat = 'asdf' as any;40  const cat = Cat.parse({ properties: { is_animal: true, jumped: true } });41  expect(cat.properties).toEqual({ is_animal: true, jumped: true });42});43 44test("deep intersection of arrays", async () => {45  const Author = z.object({46    posts: z.array(47      z.object({48        post_id: z.number(),49      })50    ),51  });52  const Registry = z53    .object({54      posts: z.array(55        z.object({56          title: z.string(),57        })58      ),59    })60    .and(Author);61 62  const posts = [63    { post_id: 1, title: "Novels" },64    { post_id: 2, title: "Fairy tales" },65  ];66  const cat = Registry.parse({ posts });67  expect(cat.posts).toEqual(posts);68  const asyncCat = await Registry.parseAsync({ posts });69  expect(asyncCat.posts).toEqual(posts);70});71 72test("invalid intersection types", async () => {73  const numberIntersection = z.intersection(74    z.number(),75    z.number().transform((x) => x + 1)76  );77 78  const syncResult = numberIntersection.safeParse(1234);79  expect(syncResult.success).toEqual(false);80  if (!syncResult.success) {81    expect(syncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types);82  }83 84  const asyncResult = await numberIntersection.spa(1234);85  expect(asyncResult.success).toEqual(false);86  if (!asyncResult.success) {87    expect(asyncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types);88  }89});90 91test("invalid array merge", async () => {92  const stringArrInt = z.intersection(93    z.string().array(),94    z95      .string()96      .array()97      .transform((val) => [...val, "asdf"])98  );99  const syncResult = stringArrInt.safeParse(["asdf", "qwer"]);100  expect(syncResult.success).toEqual(false);101  if (!syncResult.success) {102    expect(syncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types);103  }104 105  const asyncResult = await stringArrInt.spa(["asdf", "qwer"]);106  expect(asyncResult.success).toEqual(false);107  if (!asyncResult.success) {108    expect(asyncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types);109  }110});111 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai