From 61dbbb08f3aff5bc7d0f034719388f5a3d87e05d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 22:08:27 +0000 Subject: [PATCH 1/2] build(deps-dev): bump chai and @types/chai Bumps [chai](https://github.com/chaijs/chai) and [@types/chai](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/chai). These dependencies needed to be updated together. Updates `chai` from 4.4.1 to 4.5.0 - [Release notes](https://github.com/chaijs/chai/releases) - [Changelog](https://github.com/chaijs/chai/blob/main/History.md) - [Commits](https://github.com/chaijs/chai/compare/v4.4.1...v4.5.0) Updates `@types/chai` from 4.3.11 to 4.3.17 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/chai) --- updated-dependencies: - dependency-name: chai dependency-type: direct:development update-type: version-update:semver-minor - dependency-name: "@types/chai" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index b29b136..60fb67a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1143,9 +1143,9 @@ "dev": true }, "node_modules/@types/chai": { - "version": "4.3.11", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.11.tgz", - "integrity": "sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==", + "version": "4.3.17", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.17.tgz", + "integrity": "sha512-zmZ21EWzR71B4Sscphjief5djsLre50M6lI622OSySTmn9DB3j+C3kWroHfBQWXbOBwbgg/M8CG/hUxDLIloow==", "dev": true }, "node_modules/@types/chai-spies": { @@ -2224,9 +2224,9 @@ } }, "node_modules/chai": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", - "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", + "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", "dev": true, "dependencies": { "assertion-error": "^1.1.0", @@ -2235,7 +2235,7 @@ "get-func-name": "^2.0.2", "loupe": "^2.3.6", "pathval": "^1.1.1", - "type-detect": "^4.0.8" + "type-detect": "^4.1.0" }, "engines": { "node": ">=4" @@ -7209,9 +7209,9 @@ } }, "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", "dev": true, "engines": { "node": ">=4" From aea3747ad8894ec74950cca9161328c8b52af280 Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Wed, 7 Aug 2024 14:53:51 +0200 Subject: [PATCH 2/2] commatibility with the new type deductions --- test/arrays.test.ts | 16 ++++++++-------- test/proxy.test.ts | 10 +++++----- test/pymport.test.ts | 4 ++-- test/types.test.ts | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/arrays.test.ts b/test/arrays.test.ts index 873e2f3..10d2575 100644 --- a/test/arrays.test.ts +++ b/test/arrays.test.ts @@ -1,5 +1,5 @@ import { pymport, proxify, PyObject, pyval } from 'pymport'; -import { getPythonType, toPythonArray, toTypedArray } from 'pymport/array'; +import { getPythonType, toPythonArray, toTypedArray, TypedArray } from 'pymport/array'; import { assert } from 'chai'; const tests = [ @@ -13,7 +13,7 @@ const tests = [ BigInt64Array, Float32Array, Float64Array -]; +] as const; describe('array', () => { const array = proxify(pymport('array')); @@ -23,10 +23,10 @@ describe('array', () => { assert.instanceOf(a, PyObject); assert.equal(a.type, 'array.array'); - assert.equal(a.typecode, 'l'); + assert.equal((a as any).typecode, 'l'); assert.lengthOf(a, 10); - assert.equal(a.item(4), 4); // Implicit conversion using Symbol.toPrimitive + assert.equal(a.item(4), 4 as any); // Implicit conversion using Symbol.toPrimitive assert.strictEqual(a.item(4).toJS(), 4); }); @@ -35,8 +35,8 @@ describe('array', () => { it('export to TypedArray', () => { const a = array.array(getPythonType(new cons(1)), pyval('range(10)')); - const t = toTypedArray(a) as any; - assert.instanceOf(t, cons); + const t = toTypedArray(a) as TypedArray; + assert.instanceOf(t, cons as typeof tests[0]); assert.lengthOf(t, 10); assert.equal(t[4], 4); }); @@ -50,10 +50,10 @@ describe('array', () => { assert.instanceOf(a, PyObject); assert.equal(a.type, 'array.array'); - assert.equal(a.typecode, getPythonType(t)); + assert.equal((a as any).typecode, getPythonType(t)); assert.lengthOf(a, 10); - assert.equal(a.item(4), 4); // Implicit conversion using Symbol.toPrimitive + assert.equal(a.item(4), 4 as any); // Implicit conversion using Symbol.toPrimitive assert.strictEqual(a.item(4).toJS(), 4); }); }); diff --git a/test/proxy.test.ts b/test/proxy.test.ts index 260862f..c578fcd 100644 --- a/test/proxy.test.ts +++ b/test/proxy.test.ts @@ -63,7 +63,7 @@ describe('proxy', () => { const py = PyObject.fromJS({ name: 'value' }); assert.instanceOf(py, PyObject); - assert.instanceOf(py.__PyObject__, PyObject); + assert.instanceOf((py as any).__PyObject__, PyObject); }); it('proxified objects return unique references', () => { @@ -121,13 +121,13 @@ describe('proxy', () => { it('passing proxified arguments', () => { const py_array = pyval('np.array([2, 1, 0]).tolist()', { np }); assert.instanceOf(py_array, PyObject); - assert.deepEqual(py_array.toJS(), [2, 1, 0]); + assert.deepEqual((py_array as any).toJS(), [2, 1, 0]); }); it('automatic conversion to JS objects through Symbol.toPrimitive', () => { const num = PyObject.int(10); assert.instanceOf(num, PyObject); - assert.equal(+num, 10); + assert.equal(+(num as any), 10); assert.throws(() => assert.strictEqual(num, 10)); }); @@ -240,8 +240,8 @@ describe('proxy', () => { const staticMember = klass.static_member; assert.instanceOf(staticMember, PyObject); - assert.strictEqual(staticMember.type, 'int'); - assert.strictEqual(staticMember.toJS(), 42); + assert.strictEqual((staticMember as any).type, 'int'); + assert.strictEqual((staticMember as any).toJS(), 42); const name = klass.name; assert.instanceOf(name.__PyObject__, PyObject); diff --git a/test/pymport.test.ts b/test/pymport.test.ts index 44543b3..cfc272c 100644 --- a/test/pymport.test.ts +++ b/test/pymport.test.ts @@ -2,8 +2,8 @@ import { pymport, PyObject, PythonError, version } from 'pymport'; import chai from 'chai'; import spies from 'chai-spies'; chai.use(spies); -const assert = chai.assert; -const expect = chai.expect; +const assert: Chai.AssertStatic = chai.assert; +const expect: Chai.ExpectStatic = chai.expect; describe('pymport', () => { it('version', function () { diff --git a/test/types.test.ts b/test/types.test.ts index 6c86ac1..72a88e3 100644 --- a/test/types.test.ts +++ b/test/types.test.ts @@ -677,7 +677,7 @@ describe('types', () => { it('constructor', () => { const fn = PyObject.func((a: any) => { assert.instanceOf(a, PyObject); - return a + 2; + return (a as any) + 2; }); assert.instanceOf(fn, PyObject);