Skip to content

Commit 97775e4

Browse files
Can't treat binaries either
1 parent b55a8df commit 97775e4

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

pylint/checkers/format.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ def process_tokens(self, tokens: list[tokenize.TokenInfo]) -> None:
527527
"x" not in string # not a hexadecimal
528528
and "o" not in string # not an octal
529529
and "j" not in string # not a complex
530+
and "b" not in string # not a binary
530531
):
531532
self._check_bad_float_notation(line_num, start, string)
532533
if string.endswith("l"):

tests/functional/b/bad_float/bad_float_notation_default.py

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

3+
# Content of bad/good.py
34
mindless_anarchy = 1504e5 # [bad-float-notation]
45
scientific_notation = 1.504e8
56
engineering_notation = 150.4e6
67
underscore_notation = 150_400_000
78

9+
# Content of pep515 strict tests tested with default configuration
10+
not_grouped_by_three = 1_23_456_7_89 # [bad-float-notation]
11+
mixing_with_exponent = 1_23_4_5_67_8e9 # [bad-float-notation]
12+
above_threshold_without_grouping = 123456789 # [bad-float-notation]
13+
proper_grouping = 123_456_789
14+
scientific_notation_2 = 1.2345678e16
15+
engineering_notation_2 = 12.345678e15
16+
17+
# Content of bad_float_engineering_notation.py strict tests tested with default configuration
18+
exponent_not_multiple_of_three = 123e4 # [bad-float-notation]
19+
base_not_between_one_and_a_thousand = 12345e6 # [bad-float-notation]
20+
above_threshold_without_exponent = 10000000 # [bad-float-notation]
21+
under_a_thousand_with_exponent = 9.9e2 # [bad-float-notation]
22+
exponent_multiple_of_three = 1.23e6
23+
base_between_one_and_a_thousand = 12.345e9
24+
under_a_thousand = 990
25+
26+
# Content of bad_float_scientific_notation strict tests tested with default configuration
27+
base_not_between_one_and_ten = 10e3 # [bad-float-notation]
28+
above_threshold_without_exponent_2 = 10000000 # [bad-float-notation]
29+
under_ten_with_exponent = 9.9e0 # [bad-float-notation]
30+
base_between_one_and_ten = 1e4
31+
above_threshold_with_exponent = 1e7
32+
under_ten = 9.9
33+
34+
835
wrong_big = 45.3e6 # [bad-float-notation]
936
uppercase_e_wrong = 45.3E6 # [bad-float-notation]
1037
wrong_small = 0.00012e-26 # [bad-float-notation]

0 commit comments

Comments
 (0)