|
16 | 16 | from typing import Any, List, NamedTuple, Union
|
17 | 17 | from unittest import mock
|
18 | 18 |
|
19 |
| -import unittest |
20 |
| -from google3.testing.pybase import parameterized |
| 19 | +from absl.testing import absltest |
| 20 | +from absl.testing import parameterized |
21 | 21 | from ortools.math_opt.python import model
|
22 | 22 |
|
23 | 23 | _LINEAR_TYPES = (
|
|
36 | 36 | )
|
37 | 37 |
|
38 | 38 |
|
39 |
| -class BoundedExprTest(unittest.TestCase): |
| 39 | +class BoundedExprTest(absltest.TestCase): |
40 | 40 | def test_eq_float(self) -> None:
|
41 | 41 | mod = model.Model()
|
42 | 42 | x = mod.add_binary_variable(name="x")
|
@@ -333,7 +333,7 @@ def test_geq_expr(self) -> None:
|
333 | 333 | self.assertEqual(bounded_expr.upper_bound, math.inf)
|
334 | 334 |
|
335 | 335 |
|
336 |
| -class BoundedExprErrorTest(unittest.TestCase): |
| 336 | +class BoundedExprErrorTest(absltest.TestCase): |
337 | 337 | def test_ne(self) -> None:
|
338 | 338 | mod = model.Model()
|
339 | 339 | x = mod.add_binary_variable(name="x")
|
@@ -588,7 +588,7 @@ def test_bounded_expr_geq_float(self) -> None:
|
588 | 588 | # pylint: enable=pointless-statement
|
589 | 589 |
|
590 | 590 |
|
591 |
| -class BoundedExprStrAndReprTest(unittest.TestCase): |
| 591 | +class BoundedExprStrAndReprTest(absltest.TestCase): |
592 | 592 | def test_upper_bounded_expr(self) -> None:
|
593 | 593 | mod = model.Model()
|
594 | 594 | x = mod.add_binary_variable(name="x")
|
@@ -1086,7 +1086,7 @@ def test_sub(
|
1086 | 1086 | self.assertDictEqual(dict(e_inplace.terms), expected_terms)
|
1087 | 1087 |
|
1088 | 1088 |
|
1089 |
| -class QuadraticTermKey(unittest.TestCase): |
| 1089 | +class QuadraticTermKey(absltest.TestCase): |
1090 | 1090 | # Mock QuadraticTermKey.__hash__ to have a collision in the dictionary lookup
|
1091 | 1091 | # so that a correct behavior of term1 == term2 is needed to recover the
|
1092 | 1092 | # values. For instance, if QuadraticTermKey.__eq__ only compared equality of
|
@@ -2738,7 +2738,7 @@ def test_quadratic_sum_ast(self) -> None:
|
2738 | 2738 |
|
2739 | 2739 | # Test behavior of LinearExpression and as_flat_linear_expression that is
|
2740 | 2740 | # not covered by other tests.
|
2741 |
| -class LinearExpressionTest(unittest.TestCase): |
| 2741 | +class LinearExpressionTest(absltest.TestCase): |
2742 | 2742 | def test_init_to_zero(self) -> None:
|
2743 | 2743 | expression = model.LinearExpression()
|
2744 | 2744 | self.assertEqual(expression.offset, 0.0)
|
@@ -2774,7 +2774,7 @@ def test_evaluate(self) -> None:
|
2774 | 2774 |
|
2775 | 2775 | # Test behavior of QuadraticExpression and as_flat_quadratic_expression that is
|
2776 | 2776 | # not covered by other tests.
|
2777 |
| -class QuadraticExpressionTest(unittest.TestCase): |
| 2777 | +class QuadraticExpressionTest(absltest.TestCase): |
2778 | 2778 | def test_terms_read_only(self) -> None:
|
2779 | 2779 | mod = model.Model()
|
2780 | 2780 | x = mod.add_binary_variable(name="x")
|
@@ -2809,4 +2809,4 @@ def test_evaluate(self) -> None:
|
2809 | 2809 |
|
2810 | 2810 |
|
2811 | 2811 | if __name__ == "__main__":
|
2812 |
| - unittest.main() |
| 2812 | + absltest.main() |
0 commit comments