Пример #1
0
 def test_read_dictionary(self):
     dictionary = STools.read_dictionary("testdict.txt")
     self.assertEqual(len(dictionary), 2)
     self.assertEqual(len(dictionary[4]), 7)
     self.assertEqual(len(dictionary[3]), 1)
     for word in dictionary[3]:
         self.assertEqual(word, word.lower())
     dictionary = STools.read_dictionary("testdict.txt", False)
     self.assertEqual(len(dictionary), 2)
     self.assertEqual(len(dictionary[4]), 7)
     self.assertEqual(len(dictionary[3]), 2)
Пример #2
0
 def test_read_dictionary(self):
     dictionary = STools.read_dictionary("testdict.txt")
     self.assertEqual(len(dictionary), 2)
     self.assertEqual(len(dictionary[4]), 7)
     self.assertEqual(len(dictionary[3]), 1)
     for word in dictionary[3]:
         self.assertEqual(word, word.lower())
     dictionary = STools.read_dictionary("testdict.txt", False)
     self.assertEqual(len(dictionary), 2)
     self.assertEqual(len(dictionary[4]), 7)
     self.assertEqual(len(dictionary[3]), 2)
Пример #3
0
 def test_all_chains(self):
     start = "1111"
     end = "2101"
     dictionary = STools.read_dictionary("testdict.txt")[4]
     chains = STools.find_all_chains(start, end, dictionary, 5)
     self.assertEqual(len(chains), 4)
     for chain in chains:
         self.assert_is_chain(chain, start, end)
Пример #4
0
 def test_all_chains(self):
     start = "1111"
     end = "2101"
     dictionary = STools.read_dictionary("testdict.txt")[4]
     chains = STools.find_all_chains(start, end, dictionary, 5)
     self.assertEqual(len(chains), 4)
     for chain in chains:
         self.assert_is_chain(chain, start, end)
Пример #5
0
#!/usr/bin/env python3

import unittest
from ladder import StaircaseTools as STools

DICTIONARY = STools.read_dictionary("runouns.txt")


class Test(unittest.TestCase):

    def assert_is_chain(self, chain, start, end):
        self.assertNotEqual(len(chain), 0)
        self.assertEqual(chain[0], start)
        self.assertEqual(chain[-1], end)

    def test_read_dictionary(self):
        dictionary = STools.read_dictionary("testdict.txt")
        self.assertEqual(len(dictionary), 2)
        self.assertEqual(len(dictionary[4]), 7)
        self.assertEqual(len(dictionary[3]), 1)
        for word in dictionary[3]:
            self.assertEqual(word, word.lower())
        dictionary = STools.read_dictionary("testdict.txt", False)
        self.assertEqual(len(dictionary), 2)
        self.assertEqual(len(dictionary[4]), 7)
        self.assertEqual(len(dictionary[3]), 2)

    def test_correct_input(self):
        correct_input = STools.correct_input("муха", "слон", DICTIONARY[4])
        self.assertTrue(correct_input)
        correct_input = STools.correct_input("ыва", "ываы", DICTIONARY[4])
Пример #6
0
#!/usr/bin/env python3

import unittest
from ladder import StaircaseTools as STools

DICTIONARY = STools.read_dictionary("runouns.txt")


class Test(unittest.TestCase):
    def assert_is_chain(self, chain, start, end):
        self.assertNotEqual(len(chain), 0)
        self.assertEqual(chain[0], start)
        self.assertEqual(chain[-1], end)

    def test_read_dictionary(self):
        dictionary = STools.read_dictionary("testdict.txt")
        self.assertEqual(len(dictionary), 2)
        self.assertEqual(len(dictionary[4]), 7)
        self.assertEqual(len(dictionary[3]), 1)
        for word in dictionary[3]:
            self.assertEqual(word, word.lower())
        dictionary = STools.read_dictionary("testdict.txt", False)
        self.assertEqual(len(dictionary), 2)
        self.assertEqual(len(dictionary[4]), 7)
        self.assertEqual(len(dictionary[3]), 2)

    def test_correct_input(self):
        correct_input = STools.correct_input("муха", "слон", DICTIONARY[4])
        self.assertTrue(correct_input)
        correct_input = STools.correct_input("ыва", "ываы", DICTIONARY[4])
        self.assertFalse(correct_input)