Skip to content

test: make stdlib.NumericParsing Python 3 friendly #32598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions test/stdlib/NumericParsing.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// RUN: %line-directive %t/NumericParsing.swift -- %target-run %t/a.out
// REQUIRES: executable_test
%{
from __future__ import division
from SwiftIntTypes import all_integer_types

word_bits = int(CMAKE_SIZEOF_VOID_P)
Expand All @@ -36,7 +37,7 @@ Note: the third parameter, zero, is not for user consumption.
else:
r = n % radix
digit = chr((ord('0') + r) if r < 10 else (ord('a') + r - 10))
return inRadix(radix, int(n / radix), '') + digit
return inRadix(radix, int(n // radix), '') + digit

# The maximal legal radix
max_radix = ord('z') - ord('a') + 1 + 10
Expand Down Expand Up @@ -96,7 +97,7 @@ tests.test("${Self}/success") {
% for radix in radices_to_test:
% for n in required_values + list(range(
% minValue + 1, maxValue - 1,
% int((maxValue - minValue - 2) / (number_of_values - len(required_values))))):
% int((maxValue - minValue - 2) // (number_of_values - len(required_values))))):
% prefix = '+' if n > 0 and n % 2 == 0 else '' # leading '+'
% text = inRadix(radix, n)
expectEqual(${n}, ${Self}("${prefix + text}", radix: ${radix}))
Expand Down