<commit_before># encoding: utf-8

require File.expand_path('../helper', __FILE__)

class TestDineromailIpnReport < Test::Unit::TestCase

  def test_report_id
    report = DineroMailIpn::Report.new(:id => 33)
    assert_equal 33, report.id
  end

  def test_report_amount
    report = DineroMailIpn::Report.new(:amount => 3003)
    assert_equal 3003, report.amount
  end

  def test_transaction_completed?
    report = DineroMailIpn::Report.new(:state => 2)
    assert report.transaction_completed?
  end

  def test_transaction_pending?
    report = DineroMailIpn::Report.new(:state => 1)
    assert report.transaction_pending?
  end

  def test_transaction_cancelled?
    report = DineroMailIpn::Report.new(:state => 3)
    assert report.transaction_cancelled?
  end<commit_msg>adding tests to validate that state attribute for Report object can be numeric or string. IPNv2 sends an string<commit_after># encoding: utf-8

require File.expand_path('../helper', __FILE__)

class TestDineromailIpnReport < Test::Unit::TestCase

  def test_report_id
    report = DineroMailIpn::Report.new(:id => 33)
    assert_equal 33, report.id
  end

  def test_report_amount
    report = DineroMailIpn::Report.new(:amount => 3003)
    assert_equal 3003, report.amount
  end

  def test_transaction_completed?
    report = DineroMailIpn::Report.new(:state => 2)
    assert report.transaction_completed?
    report = DineroMailIpn::Report.new(:state => "2")
    assert report.transaction_completed?
  end

  def test_transaction_pending?
    report = DineroMailIpn::Report.new(:state => 1)
    assert report.transaction_pending?
    report = DineroMailIpn::Report.new(:state => "1")
    assert report.transaction_pending?
  end

  def test_transaction_cancelled?
    report = DineroMailIpn::Report.new(:state => 3)
    assert report.transaction_cancelled?
    report = DineroMailIpn::Report.new(:state => "3")
    assert report.transaction_cancelled?
  end
{'fraction_non_alphanumeric': 0.10108303249097472, 'fraction_numerical': 0.018566271273852502, 'mean_word_length': 4.434173669467787, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '3582563', 'n_tokens_mistral': 645, 'n_tokens_neox': 602, 'n_words': 134}