<commit_before>require 'test_helper'

class Superstore::Types::TimeTypeTest < Superstore::Types::TestCase
  test 'encode' do
    assert_equal '2004-12-24T01:02:03.000000Z', type.encode(Time.utc(2004, 12, 24, 1, 2, 3))
    assert_equal '2004-12-24T01:02:03.000000Z', type.encode(DateTime.new(2004, 12, 24, 1, 2, 3))
    assert_raise ArgumentError do
      type.encode 123
    end
  end

  test 'decode' do
    assert_nil type.decode(nil)
    assert_nil type.decode('bad format')
    assert_equal Time.utc(2004, 12, 24, 1, 2, 3), type.decode('2004-12-24T01:02:03.000000Z')

    Time.use_zone 'Central Time (US & Canada)' do
      with_zone = type.decode('2013-07-18T13:12:46Z')
      # assert_equal Time.utc(2013, 07, 18, 20, 12, 46), with_zone
      assert_equal 'CDT', with_zone.zone
    end
  end
end<commit_msg>re-add time_type testing for time zones<commit_after>require 'test_helper'

class Superstore::Types::TimeTypeTest < Superstore::Types::TestCase
  test 'encode' do
    assert_equal '2004-12-24T01:02:03.000000Z', type.encode(Time.utc(2004, 12, 24, 1, 2, 3))
    assert_equal '2004-12-24T01:02:03.000000Z', type.encode(DateTime.new(2004, 12, 24, 1, 2, 3))
    assert_raise ArgumentError do
      type.encode 123
    end
  end

  test 'decode' do
    assert_nil type.decode(nil)
    assert_nil type.decode('bad format')
    assert_equal Time.utc(2004, 12, 24, 1, 2, 3), type.decode('2004-12-24T01:02:03.000000Z')

    Time.use_zone 'Central Time (US & Canada)' do
      with_zone = type.decode('2013-07-18 13:12:46 -0700')
      assert_equal Time.utc(2013, 07, 18, 20, 12, 46), with_zone
      assert_equal 'CDT', with_zone.zone
    end
  end
end
{'fraction_non_alphanumeric': 0.13836858006042296, 'fraction_numerical': 0.15226586102719034, 'mean_word_length': 3.82798833819242, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4131776', 'n_tokens_mistral': 805, 'n_tokens_neox': 609, 'n_words': 144}