Skip to content

Commit 1c775bf

Browse files
More functional test using options
1 parent 5441deb commit 1c775bf

16 files changed

+64
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[main]
2+
strict-engineering-notation = true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[main]
2+
strict-underscore-notation = true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[main]
2+
strict-scientific-notation = true
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
There's 4 options associated with this message:
2+
- ``strict-engineering-notation``
3+
- ``strict-scientific-notation``
4+
- ``strict-underscore-notation``
5+
- ``threshold``
6+
By default we allow all three standard and the threshold is high.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
exponent_multiple_of_three = 1.23e6
2-
base_between_one_and_a_thousand = 12.345e9 # [bad-float-notation]
3-
under_a_thousand = 990 # [bad-float-notation]
2+
base_between_one_and_a_thousand = 12.345e9
3+
under_a_thousand = 990
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- `PEP 515 <https://docs.python.org/3/library/string.html#formatstrings>`_

doc/test_messages_documentation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ def _runTest(self) -> None:
173173
assert len(actual_messages_raw) >= len(bad_files), self.assert_message_bad(
174174
bad_files, actual_messages_raw
175175
)
176-
assert expected_messages == self._get_actual(actual_messages_raw)
176+
actual = self._get_actual(actual_messages_raw)
177+
assert_msg = f"Expected {expected_messages!r} and got {actual!r} in {self._test_file[1]}."
178+
assert expected_messages == actual, assert_msg
177179

178180
def assert_message_good(self, messages: list[Message]) -> str:
179181
good = self._test_file[1]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# pylint: disable=missing-docstring,invalid-name
2+
3+
exponent_not_multiple_of_three = 123e4 # [bad-float-notation]
4+
base_not_between_one_and_a_thousand = 12345e6 # [bad-float-notation]
5+
above_threshold_without_exponent = 10000000 # [bad-float-notation]
6+
under_a_thousand_with_exponent = 9.9e2 # [bad-float-notation]
7+
exponent_multiple_of_three = 1.23e6
8+
base_between_one_and_a_thousand = 12.345e9
9+
under_a_thousand = 990
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[main]
2+
strict-engineering-notation = true
3+
strict-scientific-notation = false
4+
strict-underscore-notation = false

tests/functional/u/use/use_standard_scientific_notation.py renamed to tests/functional/b/bad_float/bad_float_notation_default.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# pylint: disable=missing-docstring,invalid-name
22

3+
mindless_anarchy = 1504e5 # [bad-float-notation]
4+
scientific_notation = 1.504e8
5+
engineering_notation = 150.4e6
6+
underscore_notation = 150_400_000
7+
38
wrong_big = 45.3e6 # [bad-float-notation]
49
uppercase_e_wrong = 45.3E6 # [bad-float-notation]
510
wrong_small = 0.00012e-26 # [bad-float-notation]

0 commit comments

Comments
 (0)