Skip to content

#640: Refactored generic tests for java#643

Open
sgn4sangar wants to merge 13 commits into
masterfrom
refactor/640_generic_tests_java
Open

#640: Refactored generic tests for java#643
sgn4sangar wants to merge 13 commits into
masterfrom
refactor/640_generic_tests_java

Conversation

@sgn4sangar
Copy link
Copy Markdown
Contributor

relates to #640
generic tests for java alone

this branch is branched out from refactor/640_bring_db_obs_in_gen_lang_tests

@sgn4sangar sgn4sangar changed the title Refactor/640 generic tests java #640: Refactored generic tests for java May 27, 2026
# Create UDFs needed for SetWithEmptyInput tests
self.query(udf.fixindent('''
CREATE java SET SCRIPT
set_returns_has_empty_input(a double) RETURNS boolean AS
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This UDF is duplicated


self.query(udf.fixindent('''
CREATE java SET SCRIPT
set_emits_has_empty_input(a double) EMITS (x double, y varchar(10)) AS
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This UDFs is duplicated



class DynamicInputErrors(_JavaUdfSetup):
def test_exception_wrong_arg(self):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably can remove the cases for the other languages because this test only handles a single language

with self.assertRaisesRegex(Exception, err_text[self.LANG]):
self.query('''select fn1.wrong_arg('a') from dual''')

def test_exception_wrong_operation(self):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably can remove the cases for the other languages because this test only handles a single language

self.query('CREATE SCHEMA FN1')
self.query('OPEN SCHEMA FN1')
self.query(udf.fixindent('''
CREATE java SCALAR SCRIPT dob_1i_1o(x double)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, this duplicated

'''))
self.query(udf.fixindent('''
CREATE java SCALAR SCRIPT line_1i_1o(x double)
EMITS (y double) AS
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, this is duplicated

FROM DUAL''')
self.assertRowsEqual([(True, True, True)], rows)

@udf.TestCase.expectedFailureIfLang('r')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed anymore

FROM DUAL''')
self.assertRowsEqual([(True, True, True)], rows)

@udf.TestCase.expectedFailureIfLang('r')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed anymore

FROM DUAL''')
self.assertRowsEqual([(True, True, True, True)], rows)

@udf.TestCase.expectedFailureIfLang('r')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed anymore

foo_conn.query('IMPORT FROM SCRIPT fn1.impal_use_connection_fooconn')
self.query('drop user foo cascade')

@skip("IMPORT FROM SCRIPT cannot be used in view definitions")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a test for the DB, we probably can remove it

self.assertRowEqual(('GET_SCRIPT_NAME',), rows[0])

def test_script_schema(self):
if (udf.opts.is_compat_mode != "true"):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This something we need to investigate @sgn4sangar this is a comment for me

from exasol_python_test_framework import udf


class Test(udf.TestCase):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check if this is complete


locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't need this for java


class UnicodeData(_JavaUdfSetup):

# @udf.TestCase.expectedFailureIfLang('lua')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed

''')
self.assertRowsEqual([], rows)

@udf.TestCase.expectedFailureIfLang('lua')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed

parser.add_argument('--server', help='connection string')
parser.add_argument('--script-languages', help='definition of the SCRIPT_LANGUAGES variable')
opts, _unknown = parser.parse_known_args()
setattr(udf, 'pythonVersionInUdf', getPythonVersionInUDFs(opts.server, opts.script_languages))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't need this


from exasol_python_test_framework import udf

udf.pythonVersionInUdf = -1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be probably we removed

]

@useData(data)
def test_vectorsize(self, size):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably simplify this, because we know we only run java here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants