コード例 #1
0
class TestFinder(unittest.TestCase):
    def setup(self):
        self.finder = Finder()

    def test_is_singleton(self):
        obj1 = Finder()
        obj2 = Finder()
        self.assertEqual(obj1, obj2)

    # Negative Testing 1
    def test_data_empty(self):
        self.finder = Finder()
        data = self.finder.size()
        self.assertEqual(data, 0)

    # Negative Testing 1
    def test_process_data_empty(self):
        self.finder = Finder()
        data = self.finder.find()
        self.assertEqual(data, "Finding string not provided")

    # Positive Testing 1
    def test_process_data_singlelist(self):
        self.finder = Finder(['a', 'b', 'a'])
        data = self.finder.find()
        self.assertNotEqual(data, 0)

    # Positive Testing 2
    def test_process_data_multipleList(self):
        self.finder = Finder(['a', 'b', 'a', 'ab', 'cd', 'abc', 'xyz'])
        data = self.finder.find()
        self.assertNotEqual(data, 0)
コード例 #2
0
import string
from src.filter import Finder

if __name__ == '__main__':
    string_list = ["asd", "asdd", "fre", "glk", "lkm", "stdo"]
    
    finder = Finder(string_list)
    print(finder.find('sad'))

コード例 #3
0
 def setup(self):
     self.finder = Finder()
コード例 #4
0
 def test_process_data_multipleList(self):
     self.finder = Finder(['a', 'b', 'a', 'ab', 'cd', 'abc', 'xyz'])
     data = self.finder.find()
     self.assertNotEqual(data, 0)
コード例 #5
0
 def test_process_data_singlelist(self):
     self.finder = Finder(['a', 'b', 'a'])
     data = self.finder.find()
     self.assertNotEqual(data, 0)
コード例 #6
0
 def test_process_data_empty(self):
     self.finder = Finder()
     data = self.finder.find()
     self.assertEqual(data, "Finding string not provided")
コード例 #7
0
 def test_data_empty(self):
     self.finder = Finder()
     data = self.finder.size()
     self.assertEqual(data, 0)
コード例 #8
0
 def test_is_singleton(self):
     obj1 = Finder()
     obj2 = Finder()
     self.assertEqual(obj1, obj2)