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
promise.test.ts91 linesDownload Raw Back to tests
1// @ts-ignore TS61332import { expect, test } from "vitest";3 4import * as z from "zod/v3";5import { util } from "../helpers/util.js";6 7const promSchema = z.promise(8  z.object({9    name: z.string(),10    age: z.number(),11  })12);13 14test("promise inference", () => {15  type promSchemaType = z.infer<typeof promSchema>;16  util.assertEqual<promSchemaType, Promise<{ name: string; age: number }>>(true);17});18 19test("promise parsing success", async () => {20  const pr = promSchema.parse(Promise.resolve({ name: "Bobby", age: 10 }));21  expect(pr).toBeInstanceOf(Promise);22  const result = await pr;23  expect(typeof result).toBe("object");24  expect(typeof result.age).toBe("number");25  expect(typeof result.name).toBe("string");26});27 28test("promise parsing success 2", () => {29  const fakePromise = {30    then() {31      return this;32    },33    catch() {34      return this;35    },36  };37  promSchema.parse(fakePromise);38});39 40test("promise parsing fail", async () => {41  const bad = promSchema.parse(Promise.resolve({ name: "Bobby", age: "10" }));42  // return await expect(bad).resolves.toBe({ name: 'Bobby', age: '10' });43  return await expect(bad).rejects.toBeInstanceOf(z.ZodError);44  // done();45});46 47test("promise parsing fail 2", async () => {48  const failPromise = promSchema.parse(Promise.resolve({ name: "Bobby", age: "10" }));49  await expect(failPromise).rejects.toBeInstanceOf(z.ZodError);50  // done();/z51});52 53test("promise parsing fail", () => {54  const bad = () => promSchema.parse({ then: () => {}, catch: {} });55  expect(bad).toThrow();56});57 58// test('sync promise parsing', () => {59//   expect(() => z.promise(z.string()).parse(Promise.resolve('asfd'))).toThrow();60// });61 62const asyncFunction = z.function(z.tuple([]), promSchema);63 64test("async function pass", async () => {65  const validatedFunction = asyncFunction.implement(async () => {66    return { name: "jimmy", age: 14 };67  });68  await expect(validatedFunction()).resolves.toEqual({69    name: "jimmy",70    age: 14,71  });72});73 74test("async function fail", async () => {75  const validatedFunction = asyncFunction.implement(() => {76    return Promise.resolve("asdf" as any);77  });78  await expect(validatedFunction()).rejects.toBeInstanceOf(z.ZodError);79});80 81test("async promise parsing", () => {82  const res = z.promise(z.number()).parseAsync(Promise.resolve(12));83  expect(res).toBeInstanceOf(Promise);84});85 86test("resolves", () => {87  const foo = z.literal("foo");88  const res = z.promise(foo);89  expect(res.unwrap()).toEqual(foo);90});91 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai