<commit_before>require_relative '../test_helper'

module Unit
  class BettyResourceTest < MiniTest::Unit::TestCase

    describe BettyResource::Base do
      it "should return a Relation model" do
        assert BettyResource::Relation.is_a?(BettyResource::Model)
      end

      it "should return a new Relation object" do
        assert BettyResource::Relation.new.is_a?(BettyResource::Record)
      end

      it "should return the model of a BettyResource::Record" do
        assert_equal BettyResource::Relation.new.model, BettyResource::Relation
      end

      it "should return the attributes for a new BettyResource::Record" do
        relation = BettyResource::Relation.new
        assert_equal relation.attributes.keys.sort, ["first_name", "last_name"]
      end

      it "should create a method for writing each attribute" do
        relation = BettyResource::Relation.new
        assert relation.first_name = "my_first_name"
        assert relation.last_name = "my_last_name"
      end

      it "should store the value in @attributes variable" do
        relation = BettyResource::Relation.new
        relation.first_name = "my_first_name"
        assert_equal relation.attributes[:first_name], "my_first_name"
      end

      it "should create a method for reading each attribute" do
        relation = BettyResource::Relation.new
        relation.first_name = "my_first_name"
        assert_equal relation.first_name, "my_first_name"
      end

      it "should allow mass-assignment when creating a new record" do
        relation = BettyResource::Relation.new({:first_name => "my_first_name", :last_name => "my_last_name"})
        assert_equal relation.first_name, "my_first_name"
        assert_equal relation.last_name, "my_last_name"
      end

      it "should raise NameError when an unknown model is requested" do
        assert_raises(NameError) {
          assert BettyResource::DoesNotExist
        }
      end

      it "should not load unexising records" do
        assert_nil BettyResource::Relation.get(-1)
      end<commit_msg>Switch around assertions<commit_after>require_relative '../test_helper'

module Unit
  class BettyResourceTest < MiniTest::Unit::TestCase

    describe BettyResource::Base do
      it "should return a Relation model" do
        assert BettyResource::Relation.is_a?(BettyResource::Model)
      end

      it "should return a new Relation object" do
        assert BettyResource::Relation.new.is_a?(BettyResource::Record)
      end

      it "should return the model of a BettyResource::Record" do
        assert_equal BettyResource::Relation, BettyResource::Relation.new.model
      end

      it "should return the attributes for a new BettyResource::Record" do
        relation = BettyResource::Relation.new
        assert_equal ["first_name", "last_name"], relation.attributes.keys.sort
      end

      it "should create a method for writing each attribute" do
        relation = BettyResource::Relation.new
        assert relation.first_name = "my_first_name"
        assert relation.last_name = "my_last_name"
      end

      it "should store the value in @attributes variable" do
        relation = BettyResource::Relation.new
        relation.first_name = "my_first_name"
        assert_equal "my_first_name", relation.attributes[:first_name]
      end

      it "should create a method for reading each attribute" do
        relation = BettyResource::Relation.new
        relation.first_name = "my_first_name"
        assert_equal "my_first_name", relation.first_name
      end

      it "should allow mass-assignment when creating a new record" do
        relation = BettyResource::Relation.new({:first_name => "my_first_name", :last_name => "my_last_name"})
        assert_equal "my_first_name", relation.first_name
        assert_equal "my_last_name", relation.last_name
      end

      it "should raise NameError when an unknown model is requested" do
        assert_raises(NameError) {
          assert BettyResource::DoesNotExist
        }
      end

      it "should not load unexising records" do
        assert_nil BettyResource::Relation.get(-1)
      end
{'fraction_non_alphanumeric': 0.07634694370620923, 'fraction_numerical': 0.00048320850446967865, 'mean_word_length': 3.0548481880509306, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2865514', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1112, 'n_words': 325}