1
0
mirror of https://github.com/bspeice/dtparse synced 2024-11-14 09:58:09 -05:00

Add an auto-generated header

This commit is contained in:
Bradlee Speice 2018-05-23 23:11:20 -04:00
parent b1f8cd77ee
commit c3abcd4a55
3 changed files with 19 additions and 4 deletions

View File

@ -10,6 +10,13 @@ TEST_STRINGS = [
'Mar. 5, 2018', 'Mar. 5, 2018',
] ]
AUTOGEN_HEADER = '''
// WARNING
// This file was auto-generated using the `build_tests.py` script.
// Please do not edit it manually.
'''
S4 = ' ' * 4 S4 = ' ' * 4
S8 = ' ' * 8 S8 = ' ' * 8
S12 = ' ' * 12 S12 = ' ' * 12
@ -31,8 +38,8 @@ def rust_tokenize(time_string):
return [translate_token(t) for t in split_array] return [translate_token(t) for t in split_array]
def build_split_string_tests(): def build_split_string_tests():
header = '''use ::Token; header = '''use Token;
use ::tokenize; use tokenize;
#[test] #[test]
fn test_python_compat() {\n''' fn test_python_compat() {\n'''
@ -76,8 +83,8 @@ fn test_python_compat() {\n'''
if __name__ == '__main__': if __name__ == '__main__':
split_string_test = build_split_string_tests() split_string_test = build_split_string_tests()
with open('src/tests/compat_split_string.rs', 'w+') as handle: with open('src/tests/compat_split_string.rs', 'w+') as handle:
handle.write(split_string_test) handle.write(AUTOGEN_HEADER + split_string_test)
parse_test = build_parse_tests() parse_test = build_parse_tests()
with open('src/tests/compat_parse.rs', 'w+') as handle: with open('src/tests/compat_parse.rs', 'w+') as handle:
handle.write(parse_test) handle.write(AUTOGEN_HEADER + parse_test)

View File

@ -1,3 +1,7 @@
// WARNING
// This file was auto-generated using the `build_tests.py` script.
// Please do not edit it manually.
use chrono::SecondsFormat; use chrono::SecondsFormat;
use parse; use parse;

View File

@ -1,3 +1,7 @@
// WARNING
// This file was auto-generated using the `build_tests.py` script.
// Please do not edit it manually.
use Token; use Token;
use tokenize; use tokenize;