<commit_before><commit_msg>adding missing file<commit_after>#!/usr/bin/python
# -*- encoding: utf-8 -*-
import os
from nose.tools import raises


def test_date_util_parse():
    from pyexcel_ods3.ods import date_value
    value = "2015-08-17T19:20:00"
    d = date_value(value)
    assert d.strftime("%Y-%m-%dT%H:%M:%S") == "2015-08-17T19:20:00"
    value = "2015-08-17"
    d = date_value(value)
    assert d.strftime("%Y-%m-%d") == "2015-08-17"
    value = "2015-08-17T19:20:59.999999"
    d = date_value(value)
    assert d.strftime("%Y-%m-%dT%H:%M:%S") == "2015-08-17T19:20:59"
    value = "2015-08-17T19:20:59.99999"
    d = date_value(value)
    assert d.strftime("%Y-%m-%dT%H:%M:%S") == "2015-08-17T19:20:59"
    value = "2015-08-17T19:20:59.999999999999999"
    d = date_value(value)
    assert d.strftime("%Y-%m-%dT%H:%M:%S") == "2015-08-17T19:20:59"
    
@raises(Exception)
def test_invalid_date():
    from pyexcel_ods3.ods import date_value
    value = "2015-08-"
    date_value(value)

@raises(Exception)
def test_fake_date_time_10():
    from pyexcel_ods3.ods import date_value
    date_value("1234567890")

@raises(Exception)
def test_fake_date_time_19():
    from pyexcel_ods3.ods import date_value
    date_value("1234567890123456789")

@raises(Exception)
def test_fake_date_time_20():
    from pyexcel_ods3.ods import date_value
    date_value("12345678901234567890")


def test_issue_10():
    test_file_name = "test_issue_10.ods"
    from pyexcel_ods3 import save_data
    content = {"test":[[1, 2]]}
    save_data(test_file_name, content)
    save_data(test_file_name, content)
    assert os.path.exists(test_file_name)
    assert os.path.exists(test_file_name + ".bak") == False
    os.unlink(test_file_name)
{'fraction_non_alphanumeric': 0.15722543352601157, 'fraction_numerical': 0.13179190751445086, 'mean_word_length': 4.151785714285714, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '480283', 'n_tokens_mistral': 848, 'n_tokens_neox': 688, 'n_words': 108}