You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2021/02/12 20:20:20 UTC

[lucenenet] branch master updated: Reviewed classification tests and made minor changes. Part of issue #259 (#420)

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


The following commit(s) were added to refs/heads/master by this push:
     new d13f8cf  Reviewed classification tests and made minor changes. Part of issue #259 (#420)
d13f8cf is described below

commit d13f8cffb860ea3b725abc62eecb239ee9886a09
Author: Ron Clabo <rc...@users.noreply.github.com>
AuthorDate: Fri Feb 12 15:20:13 2021 -0500

    Reviewed classification tests and made minor changes. Part of issue #259 (#420)
    
    * Reviewed classification tests. Made minor changes and uncommented 1 test and verified it passes.  See issue #259
    
    * Finished my work ;-)
---
 .../Support/TestApiConsistency.cs                  | 16 ++++-----
 .../Utils/DataSplitterTest.cs                      | 42 +++++++++++-----------
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/src/Lucene.Net.Tests.Classification/Support/TestApiConsistency.cs b/src/Lucene.Net.Tests.Classification/Support/TestApiConsistency.cs
index 8ce487b..d60e6c2 100644
--- a/src/Lucene.Net.Tests.Classification/Support/TestApiConsistency.cs
+++ b/src/Lucene.Net.Tests.Classification/Support/TestApiConsistency.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Attributes;
+using Lucene.Net.Attributes;
 using Lucene.Net.Util;
 using NUnit.Framework;
 using System;
@@ -111,7 +111,7 @@ namespace Lucene.Net.Classification
         public override void TestForPublicMembersContainingNonNetNumeric(Type typeFromTargetAssembly)
         {
             base.TestForPublicMembersContainingNonNetNumeric(typeFromTargetAssembly);
-        }        
+        }
 
         [Test, LuceneNetSpecific]
         [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))]
@@ -129,12 +129,12 @@ namespace Lucene.Net.Classification
 
         // LUCENENET NOTE: This test is only for identifying members who were changed from
         // ICollection, IList or ISet to IEnumerable during the port (that should be changed back)
-        //[Test, LuceneNetSpecific]
-        //[TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))]
-        //public override void TestForMembersAcceptingOrReturningIEnumerable(Type typeFromTargetAssembly)
-        //{
-        //    base.TestForMembersAcceptingOrReturningIEnumerable(typeFromTargetAssembly);
-        //}
+        [Test, LuceneNetSpecific]
+        [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))]
+        public override void TestForMembersAcceptingOrReturningIEnumerable(Type typeFromTargetAssembly)
+        {
+            base.TestForMembersAcceptingOrReturningIEnumerable(typeFromTargetAssembly);
+        }
 
         [Test, LuceneNetSpecific]
         [TestCase(typeof(Lucene.Net.Classification.KNearestNeighborClassifier))]
diff --git a/src/Lucene.Net.Tests.Classification/Utils/DataSplitterTest.cs b/src/Lucene.Net.Tests.Classification/Utils/DataSplitterTest.cs
index 0f7d9ec..30ed545 100644
--- a/src/Lucene.Net.Tests.Classification/Utils/DataSplitterTest.cs
+++ b/src/Lucene.Net.Tests.Classification/Utils/DataSplitterTest.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Text;
 using Lucene.Net.Analysis;
 using Lucene.Net.Classification.Utils;
@@ -32,24 +32,24 @@ namespace Lucene.Net.Classification
      */
     public class DataSplitterTest : Util.LuceneTestCase
     {
-        private AtomicReader _originalIndex;
-        private RandomIndexWriter _indexWriter;
-        private Directory _dir;
+        private AtomicReader originalIndex;
+        private RandomIndexWriter indexWriter;
+        private Directory dir;
 
-        private String _textFieldName = "text";
-        private String _classFieldName = "class";
-        private String _idFieldName = "id";
+        private String textFieldName = "text";
+        private String classFieldName = "class";
+        private String idFieldName = "id";
 
         [SetUp]
         public override void SetUp()
         {
             base.SetUp();
-            _dir = NewDirectory();
-            _indexWriter = new RandomIndexWriter(
+            dir = NewDirectory();
+            indexWriter = new RandomIndexWriter(
 #if FEATURE_INSTANCE_TESTDATA_INITIALIZATION
                 this,
 #endif
-                Random, _dir, new MockAnalyzer(Random));
+                Random, dir, new MockAnalyzer(Random));
 
             FieldType ft = new FieldType(TextField.TYPE_STORED);
             ft.StoreTermVectors = true;
@@ -62,38 +62,38 @@ namespace Lucene.Net.Classification
             for (int i = 0; i < 100; i++)
             {
                 doc = new Document();
-                doc.Add(new Field(_idFieldName, Random.toString(), ft));
-                doc.Add(new Field(_textFieldName, new StringBuilder(Random.toString()).append(Random.toString()).append(
+                doc.Add(new Field(idFieldName, Random.toString(), ft));
+                doc.Add(new Field(textFieldName, new StringBuilder(Random.toString()).append(Random.toString()).append(
                     Random.toString()).toString(), ft));
-                doc.Add(new Field(_classFieldName, Random.toString(), ft));
-                _indexWriter.AddDocument(doc, analyzer);
+                doc.Add(new Field(classFieldName, Random.toString(), ft));
+                indexWriter.AddDocument(doc, analyzer);
             }
 
-            _indexWriter.Commit();
+            indexWriter.Commit();
 
-            _originalIndex = SlowCompositeReaderWrapper.Wrap(_indexWriter.GetReader());
+            originalIndex = SlowCompositeReaderWrapper.Wrap(indexWriter.GetReader());
         }
 
         [TearDown]
         public override void TearDown()
         {
-            _originalIndex.Dispose();
-            _indexWriter.Dispose();
-            _dir.Dispose();
+            originalIndex.Dispose();
+            indexWriter.Dispose();
+            dir.Dispose();
             base.TearDown();
         }
 
         [Test]
         public void TestSplitOnAllFields()
         {
-            AssertSplit(_originalIndex, 0.1, 0.1);
+            AssertSplit(originalIndex, 0.1, 0.1);
         }
 
 
         [Test]
         public void TestSplitOnSomeFields()
         {
-            AssertSplit(_originalIndex, 0.2, 0.35, _idFieldName, _textFieldName);
+            AssertSplit(originalIndex, 0.2, 0.35, idFieldName, textFieldName);
         }
 
         public static void AssertSplit(AtomicReader originalIndex, double testRatio, double crossValidationRatio, params string[] fieldNames)