From 4c4a058d8cd1e33eff43701afbf6fe89f3cd8019 Mon Sep 17 00:00:00 2001 From: Semyon Proshev Date: Mon, 6 Feb 2017 15:44:17 +0300 Subject: [PATCH] Update test for NumpyRateResolver. Test verifies that NumpyRateResolver doesn't increase rate for right operator found in stub in case of NDARRAY type not found. --- .../aaa.pyi | 5 +++++ .../com/jetbrains/python/Py3TypeTest.java | 19 +++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 python/testData/types/NumpyResolveRaterDoesNotIncreaseRateForNotNdarrayRightOperatorFoundInStub/aaa.pyi diff --git a/python/testData/types/NumpyResolveRaterDoesNotIncreaseRateForNotNdarrayRightOperatorFoundInStub/aaa.pyi b/python/testData/types/NumpyResolveRaterDoesNotIncreaseRateForNotNdarrayRightOperatorFoundInStub/aaa.pyi new file mode 100644 index 000000000000..5891129d9f8e --- /dev/null +++ b/python/testData/types/NumpyResolveRaterDoesNotIncreaseRateForNotNdarrayRightOperatorFoundInStub/aaa.pyi @@ -0,0 +1,5 @@ +class D1(object): + def __div__(self, other) -> "D1": ... + +class D2(object): + def __rtruediv__(self, other) -> "D2": ... \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/Py3TypeTest.java b/python/testSrc/com/jetbrains/python/Py3TypeTest.java index d7a63b84c171..6885f6f1a82c 100644 --- a/python/testSrc/com/jetbrains/python/Py3TypeTest.java +++ b/python/testSrc/com/jetbrains/python/Py3TypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -481,15 +481,14 @@ public class Py3TypeTest extends PyTestCase { "expr = sum([1, 2, 3])"); } - public void testDecimalDividedByInt() { - doTest("Union[Decimal, int]", - "class Decimal(object):\n" + - " def __div__(self, other):\n" + - " \"\"\"\n" + - " :rtype: Decimal" + - " \"\"\"\n" + - " pass\n" + - "expr = Decimal() / 5"); + public void testNumpyResolveRaterDoesNotIncreaseRateForNotNdarrayRightOperatorFoundInStub() { + myFixture.copyDirectoryToProject(TEST_DIRECTORY + getTestName(false), ""); + doTest("Union[D2, D1]", + "class D1(object):\n" + + " pass\n" + + "class D2(object):\n" + + " pass\n" + + "expr = D1() / D2()"); } private void doTest(final String expectedType, final String text) {