Esempio n. 1
0
def test_count():
    case1 = "aabbabb"
    case2 = "ccaabb"
    case3 = "jllkd"
    case4 = "nbmmbn"

    eq_(count(case1), "YES")
    eq_(count(case2), "YES")
    eq_(count(case3), "NO")
    eq_(count(case4), "YES")
Esempio n. 2
0
 def test_7(self):
     r = 5
     c = 1
     k = 3
     expected = 3
     answer = main.count(r, c, k)
     self.assertEqual(answer, expected)
Esempio n. 3
0
 def test_8(self):
     r = 3
     c = 4
     k = 5
     expected = 0
     answer = main.count(r, c, k)
     self.assertEqual(answer, expected)
Esempio n. 4
0
 def test_9(self):
     r = 12
     c = 10
     k = 8
     expected = 116
     answer = main.count(r, c, k)
     self.assertEqual(answer, expected)
Esempio n. 5
0
 def test_10(self):
     r = 97
     c = 83
     k = 5
     expected = 30076
     answer = main.count(r, c, k)
     self.assertEqual(answer, expected)
Esempio n. 6
0
 def test_1(self):
     r = 3
     c = 3
     k = 3
     expected = 8
     answer = main.count(r, c, k)
     self.assertEqual(answer, expected)
Esempio n. 7
0
 def test_2(self):
     r = 3
     c = 3
     k = 2
     expected = 20
     answer = main.count(r, c, k)
     self.assertEqual(answer, expected)
Esempio n. 8
0
 def test_3(self):
     r = 3
     c = 4
     k = 1
     expected = 12
     answer = main.count(r, c, k)
     self.assertEqual(answer, expected)
Esempio n. 9
0
 def test_4(self):
     r = 1
     c = 5
     k = 5
     expected = 1
     answer = main.count(r, c, k)
     self.assertEqual(answer, expected)
Esempio n. 10
0
 def test_5(self):
     r = 1
     c = 5
     k = 3
     expected = 3
     answer = main.count(r, c, k)
     self.assertEqual(answer, expected)
Esempio n. 11
0
 def test_6(self):
     r = 5
     c = 1
     k = 5
     expected = 1
     answer = main.count(r, c, k)
     self.assertEqual(answer, expected)
Esempio n. 12
0
 def test_count(self):
     for reprints, units, expected in [
         (1, 10000, 5),
         (2, 10000, 8),
     ]:
         self.assertEqual(
             expected,
             main.count(reprints, units),
             '{}, {}'.format(reprints, units)
         )
Esempio n. 13
0
def test_main():
    """test for main function"""
    case1 = 12
    case2 = 6
    case3 = 10
    case4 = 20
    case5 = 3
    case6 = 2
    case7 = 11

    eq_(main.count(case1), 36)
    eq_(main.count(case2), 9)
    eq_(main.count(case3), 25)
    eq_(main.count(case4), 100)
    eq_(main.count(case5), 2)
    eq_(main.count(case6), 1)
    eq_(main.count(case7), 30)
Esempio n. 14
0
def test_main():
    """test for main function"""
    case1 = [1, 2, 100, 0]
    case2 = [3, 5, 6, 0]
    case3 = [1, 10, 6, 0]
    case4 = [3, 6, 60, 0]
    case5 = [1, 2, 145, 0]
    case6 = [1, 2, 2, 0]
    case7 = [4, 6, 5, 0]

    eq_(main.count(case1[0], case1[1], case1[2], case1[3]), 200)
    eq_(main.count(case2[0], case2[1], case2[2], case2[3]), 18)
    eq_(main.count(case3[0], case3[1], case3[2], case3[3]), 60)
    eq_(main.count(case4[0], case4[1], case4[2], case4[3]), 240)
    eq_(main.count(case5[0], case5[1], case5[2], case5[3]), 290)
    eq_(main.count(case6[0], case6[1], case6[2], case6[3]), 4)
    eq_(main.count(case7[0], case7[1], case7[2], case7[3]), 15)
Esempio n. 15
0
def test_main():
    """test for main function"""
    case1 = [12, 4, 4]
    case2 = [6, 2, 2]
    case3 = [10, 5, 6]
    case4 = [20, 1, 2]
    case5 = [1, 10, 1]
    case6 = [2, 2, 2]
    case7 = [10, 2, 5]

    eq_(main.count(case1[0], case1[1], case1[2]), 3)
    eq_(main.count(case2[0], case2[1], case2[2]), 5)
    eq_(main.count(case3[0], case3[1], case3[2]), 2)
    eq_(main.count(case4[0], case4[1], case4[2]), 39)
    eq_(main.count(case5[0], case5[1], case5[2]), 0)
    eq_(main.count(case6[0], case6[1], case6[2]), 1)
    eq_(main.count(case7[0], case7[1], case7[2]), 6)
Esempio n. 16
0
def test_main():
    """test for main function"""
    case1 = [4, 10, 100]
    case2 = [6, 2, 2]
    case3 = [10, 5, 6]
    case4 = [20, 1, 2]
    case5 = [1, 10, 1]
    case6 = [2, 2, 2]
    case7 = [10, 2, 5]

    eq_(main.count(case1[0], case1[1], case1[2]), [30, 120, 210, 300])
    eq_(main.count(case2[0], case2[1], case2[2]), [10])
    eq_(main.count(case3[0], case3[1], case3[2]), [45, 46, 47, 48, 49, 50, 51, 52, 53, 54])
    eq_(main.count(case4[0], case4[1], case4[2]), [19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38])
    eq_(main.count(case5[0], case5[1], case5[2]), [0])
    eq_(main.count(case6[0], case6[1], case6[2]), [2])
    eq_(main.count(case7[0], case7[1], case7[2]), [18, 21, 24, 27, 30, 33, 36, 39, 42, 45])
Esempio n. 17
0
def test_count():
    assert count("abc") == 3
    assert count("a\nb\nc") == 3
    assert count("a\na\na") == 1
    assert count("ab\nac") == 3
Esempio n. 18
0
def test_for_2():
    number = 2
    eq_(main.count(number), -1)
Esempio n. 19
0
def test_for_7():
    number = 7
    eq_(main.count(number), -1)
Esempio n. 20
0
def test_for_30():
    number = 30
    eq_(main.count(number), int('555' * 10))
Esempio n. 21
0
def test_for_8():
    number = 8
    eq_(main.count(number), 55533333)
Esempio n. 22
0
def test_for_3():
    number = 3
    eq_(main.count(number), 555)
Esempio n. 23
0
def test_for_115():
    number = 115
    eq_(main.count(number), 5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555553333333333)
Esempio n. 24
0
 def test2(self):
     self.assertEqual(main.count(''), {})
Esempio n. 25
0
def test_for_5():
    number = 5
    eq_(main.count(number), 33333)
Esempio n. 26
0
 def test1(self):
     self.assertEqual(main.count('aba'), {'a': 2, 'b': 1})
Esempio n. 27
0
def test_count():
    assert count(rules(TEST)) == 4
Esempio n. 28
0
import main     #student solution to the hw
import TA_main  #ta's solution to the hw
from session import Session  #import the session object

sess = Session(TA_main, main)
# main_proxy = sess.get_module_proxy()
basic_compare = sess.compare()

if basic_compare:
  sess.score_key('basic_compare', 20)
  test_count = main.count(5)
  # test_count = main_proxy.count(5)
  TA_COUNT = TA_main.count(5)
  if test_count == TA_COUNT:
    sess.i_log('test_count(5)', "PASSED")
    sess.i_log('test_count(5)', "booyah")
    sess.score_key('testcount5', 5)

  sess.test_hw_function('count', [0, -5, 10], [-1, 2.5, 7])
  # sqInt_test = main_proxy.SquareInt(4)
  # sqit = sqInt_test.square()

else:
  sess.x_log("WHOOPS", "ERROR: your function/class names did not match up with those provided in the solution key. please look over your work and resubmit")
final = sess.finalize()

def test_count():
    series = count('hello my friend')
    expected = [5, 2, 6]
    assert list(series) == expected
Esempio n. 30
0
def test_count():
    assert count(TREES.split("\n"), 1, 3) == 7