|
1 |
| -# from typing import Any |
2 |
| -# from unittest.mock import PropertyMock, patch |
3 |
| -# |
4 |
| -# import pytest |
5 |
| -# |
6 |
| -# from pandas.core.computation.pytables import BinOp, TermValue |
7 |
| -# from pandas.core.series import Series |
8 |
| -# |
9 |
| -# |
10 |
| -# @patch( |
11 |
| -# "pandas.core.computation.pytables.BinOp.kind", |
12 |
| -# new_callable=PropertyMock, |
13 |
| -# return_value="integer", |
14 |
| -# ) |
15 |
| -# @patch( |
16 |
| -# "pandas.core.computation.pytables.BinOp.meta", |
17 |
| -# new_callable=PropertyMock, |
18 |
| -# return_value="category", |
19 |
| -# ) |
20 |
| -# @patch( |
21 |
| -# "pandas.core.computation.pytables.BinOp.metadata", |
22 |
| -# new_callable=PropertyMock, |
23 |
| -# return_value=Series(data=["a", "b", "s"]), |
24 |
| -# ) |
25 |
| -# @pytest.mark.parametrize( |
26 |
| -# "value, expected_results", |
27 |
| -# [("q", TermValue(-1, -1, "integer")), ("a", TermValue(0, 0, "integer"))], |
28 |
| -# ) |
29 |
| -# def test_convert_value( |
30 |
| -# mock_kind, mock_meta, mock_metadata, value: Any, expected_results: TermValue |
31 |
| -# ): |
32 |
| -# |
33 |
| -# with patch.object(BinOp, "__init__", lambda p1, p2, p3, p4, p5, p6: None): |
34 |
| -# bin_op = BinOp(None, None, None, None, None) |
35 |
| -# bin_op.encoding = "UTF-8" |
36 |
| -# |
37 |
| -# result = bin_op.convert_value(value) |
38 |
| -# |
39 |
| -# assert ( |
40 |
| -# result.kind == expected_results.kind |
41 |
| -# and result.value == expected_results.value |
42 |
| -# and result.converted == expected_results.converted |
43 |
| -# ) |
0 commit comments