예제 #1
0
 def test_bg(self):
     input = [
         ("B", 1),
         ("u", 1),
         (1, 1),
         ("l", 1),
         ("g", 1),
         ("a", 1),
         ("r", 1),
         ("i", 1),
         (1, 2),
         (4, 3),
         ("a", 1),
         (3, 1),
     ]
     self.assertEqual("Bulgaria", solution.extract_type(input, str))
예제 #2
0
 def test_num(self):
     input = [
         ("B", 1),
         ("u", 1),
         (1, 1),
         ("l", 1),
         ("g", 1),
         ("a", 1),
         ("r", 1),
         ("i", 1),
         (1, 2),
         (4, 3),
         ("a", 1),
         (3, 1),
     ]
     self.assertEqual("1114443", solution.extract_type(input, int))
예제 #3
0
 def test_extract_type_with_bool(self):
     self.assertEqual(s.extract_type(self.data, bool),
                      'TrueTrueFalseFalse')
예제 #4
0
 def test_extract_type_with_set(self):
     self.assertEqual(s.extract_type(self.data, set),
                      'set()set()set()set()set(){1, 2}{1, 2}{1, 2}')
예제 #5
0
 def test_extract_type_with_tuple(self):
     self.assertEqual(s.extract_type(self.data, tuple),
                      '(1, 2)(1, 2)(3, 4)(3, 4)(3, 4)()()()')
예제 #6
0
 def test_extract_type_with_bool(self):
     self.assertEqual(s.extract_type(self.data, bool), 'TrueTrueFalseFalse')
예제 #7
0
 def test_with_empty_list(self):
     self.assertEqual('', s.extract_type([], type))
예제 #8
0
 def test_num(self):
     input = [('B', 1), ('u', 1), (1, 1), ('l', 1), ('g', 1),
              ('a', 1), ('r', 1), ('i', 1), (1, 2), (4, 3),
              ('a', 1), (3, 1)]
     self.assertEqual("1114443", s.extract_type(input, int))
예제 #9
0
 def test_python(self):
     input = [('p', 1), ('y', 1), ('t', 1),
              ('h', 1), ('o', 1), ('n', 1)]
     self.assertEqual("python", s.extract_type(input, str))
예제 #10
0
 def test_some_types(self):
     input = [("a", 1), (5, 10), ("p", 2), ("l", 1), ("e", 1), (14, 2)]
     self.assertEqual("apple", solution.extract_type(input, str))
예제 #11
0
 def test_python(self):
     input = [("p", 1), ("y", 1), ("t", 1), ("h", 1), ("o", 1), ("n", 1)]
     self.assertEqual("python", solution.extract_type(input, str))
예제 #12
0
 def test_fave(self):
     input = [("r", 1), ("o", 1), (1, 1), ("s", 2), ("o", 1), (5, 0), ("n", 1), ("e", 1), (1, 2), ("r", 1), ("o", 1)]
     self.assertEqual("rossonero", solution.extract_type(input, str))
예제 #13
0
 def test_snake(self):
     input = [('s', 1), ('n', 1), ('a', 1),
              ('k', 1), ('e', 1), (55, 1)]
     self.assertEqual("snake", solution.extract_type(input, str))
예제 #14
0
 def test_number(self):
     input = [('hg', 19), ('h', 15), (1, 4), ('kk', 4), ('yu', 1),
              ('a', 1), ('k', 1), ('qqw', 1), (1, 2), (4, 3),
              ('kl', 1), (3, 10)]
     self.assertEqual("1111114443333333333", solution.extract_type(input, int))
예제 #15
0
 def test_bool(self):
     input_ = [(True, 1), ("and", 1), (False, 1), ('==', 1), (False, 1)]
     self.assertEqual("TrueFalseFalse", s.extract_type(input_, bool))
예제 #16
0
 def test_int(self):
     input_ = [({'a': 10}, 1), (1, 4), (0.2, 3), (2, 3), (True, 2),
               (3, 2), ("something", 1), (4, 1), (5, 0)]
     self.assertEqual("1111222334", s.extract_type(input_, int))
예제 #17
0
 def test_gopher(self):
     input_ = [('g', 1), ((1, 2), 3), ('op', 1), (3.1415, 1), ('h', 1),
               (False, 1), ('e', 1), ([], 5), ('r', 1)]
     self.assertEqual("gopher", s.extract_type(input_, str))
예제 #18
0
 def test_bool(self):
     input_ = [(True, 1), ("and", 1), (False, 1), ('==', 1), (False, 1)]
     self.assertEqual("TrueFalseFalse", s.extract_type(input_, bool))
예제 #19
0
 def test_fave(self):
     input = [('r', 1), ('o', 1), (1, 1), ('s', 2), ('o', 1), (5, 0),
              ('n', 1), ('e', 1), (1, 2), ('r', 1), ('o', 1)]
     self.assertEqual("rossonero", s.extract_type(input, str))
예제 #20
0
 def test_list_simitli(self):
     input_ = [(['S', 'I', 'M'], 1), (type, 2), (['I'], 1), ({}, 10),
               (['T', 'L', 'I'], 1), ([1, 2, 3, 4], 0), (13, 1)]
     self.assertEqual("['S', 'I', 'M']['I']['T', 'L', 'I']",
                      s.extract_type(input_, list))
예제 #21
0
 def test_with_ints_and_floats(self):
     self.assertEqual("42.151.3", s.extract_type(
         [(1, 1), (42.15, 1), (0, 0), (1.3, 1)],
         float))
예제 #22
0
 def test_gopher(self):
     input_ = [('g', 1), ((1, 2), 3), ('op', 1), (3.1415, 1),
               ('h', 1), (False, 1), ('e', 1), ([], 5), ('r', 1)]
     self.assertEqual("gopher", s.extract_type(input_, str))
예제 #23
0
 def test_america(self):
     input = [('A', 1), ('m', 1), ('e', 1), ('r', 1), ('i', 1),
              (33, 1), (453, 1), (2, 1), ('c', 1), (4, 3),
              ('a', 1), (3, 1)]
     self.assertEqual("America", solution.extract_type(input, str))
예제 #24
0
 def test_aalabbalaa(self):
     input_ = [('a', 2), ('l', 1), ('error', 0), ('a', 1), ('b', 2),
               ('a', 1), ('l', 1), ('a', 2)]
     self.assertEqual("aalabbalaa", s.extract_type(input_, str))
예제 #25
0
 def test_extract_type_with_string(self):
     self.assertEqual(s.extract_type(self.data, str), 'aizzzzz')
예제 #26
0
 def test_fave(self):
     input = [('r', 1), ('o', 1), (1, 1), ('s', 2), ('o', 1), (5, 0),
              ('n', 1), ('e', 1), (1, 2), ('r', 1), ('o', 1)]
     self.assertEqual("rossonero", solution.extract_type(input, str))
예제 #27
0
 def test_extract_type_with_list(self):
     self.assertEqual(s.extract_type(self.data, list),
                      '[][][][][1, 2][1, 2][3, 4][3, 4][3, 4]')
예제 #28
0
 def test_bg(self):
     input = [('B', 1), ('u', 1), (1, 1), ('l', 1), ('g', 1), ('a', 1),
              ('r', 1), ('i', 1), (1, 2), (4, 3), ('a', 1), (3, 1)]
     self.assertEqual("Bulgaria", solution.extract_type(input, str))
예제 #29
0
 def test_extract_type_with_dict(self):
     self.assertEqual(s.extract_type(self.data, dict),
                      "{}{'a': 2}{'a': 2}")
예제 #30
0
 def test_num(self):
     input = [('B', 1), ('u', 1), (1, 1), ('l', 1), ('g', 1), ('a', 1),
              ('r', 1), ('i', 1), (1, 2), (4, 3), ('a', 1), (3, 1)]
     self.assertEqual("1114443", solution.extract_type(input, int))
예제 #31
0
 def test_int(self):
     input_ = [({
         'a': 10
     }, 1), (1, 4), (0.2, 3), (2, 3), (True, 2), (3, 2), ("something", 1),
               (4, 1), (5, 0)]
     self.assertEqual("1111222334", s.extract_type(input_, int))
예제 #32
0
 def test_python(self):
     input = [('p', 1), ('y', 1), ('t', 1), ('h', 1), ('o', 1), ('n', 1)]
     self.assertEqual("python", solution.extract_type(input, str))
예제 #33
0
 def test_list_simitli(self):
     input_ = [(['S', 'I', 'M'], 1), (type, 2), (['I'], 1), ({}, 10),
               (['T', 'L', 'I'], 1), ([1, 2, 3, 4], 0), (13, 1)]
     self.assertEqual("['S', 'I', 'M']['I']['T', 'L', 'I']",
                      s.extract_type(input_, list))
예제 #34
0
 def test_some_types(self):
     input = [('a', 1), (5, 10), ('p', 2), ('l', 1), ('e', 1), (14, 2)]
     self.assertEqual("apple", solution.extract_type(input, str))
예제 #35
0
 def test_aalabbalaa(self):
     input_ = [('a', 2), ('l', 1), ('error', 0), ('a', 1), ('b', 2),
               ('a', 1), ('l', 1), ('a', 2)]
     self.assertEqual("aalabbalaa", s.extract_type(input_, str))
예제 #36
0
 def test_extract_type_with_string(self):
     self.assertEqual(s.extract_type(self.data, str), 'aizzzzz')
예제 #37
0
 def test_some_types(self):
     input = [('a', 1), (5, 10), ('p', 2),
              ('l', 1), ('e', 1), (14, 2)]
     self.assertEqual("apple", s.extract_type(input, str))
예제 #38
0
 def test_extract_type_with_tuple(self):
     self.assertEqual(s.extract_type(self.data, tuple),
                      '(1, 2)(1, 2)(3, 4)(3, 4)(3, 4)()()()')
예제 #39
0
 def test_bg(self):
     input = [('B', 1), ('u', 1), (1, 1), ('l', 1), ('g', 1),
              ('a', 1), ('r', 1), ('i', 1), (1, 2), (4, 3),
              ('a', 1), (3, 1)]
     self.assertEqual("Bulgaria", s.extract_type(input, str))
예제 #40
0
 def test_extract_type_with_list(self):
     self.assertEqual(s.extract_type(self.data, list),
                      '[][][][][1, 2][1, 2][3, 4][3, 4][3, 4]')
예제 #41
0
 def test_string_with_different_types(self):
     fizzbuzz_input = [('f', 1), (5, 10), ('i', 1), (0.3, 100),
                       ('z', 2), ('bu', 1), ('z', 2)]
     self.assertEqual("fizzbuzz", s.extract_type(fizzbuzz_input, str))
예제 #42
0
 def test_extract_type_with_set(self):
     self.assertEqual(s.extract_type(self.data, set),
                      'set()set()set()set()set(){1, 2}{1, 2}{1, 2}')
예제 #43
0
 def test_with_no_symbols_of_given_type(self):
     self.assertEqual('', s.extract_type([('a', 1), ('b', 1)], int))
예제 #44
0
 def test_extract_type_with_dict(self):
     self.assertEqual(s.extract_type(self.data, dict), "{}{'a': 2}{'a': 2}")
예제 #45
0
 def test_string_and_list(self):
     fizzbuzz_input = [('f', 1), ([], 0), ('i', 1),
                       ('z', 2), ('bu', 1), ('z', 2)]
     self.assertEqual("fizzbuzz", s.extract_type(fizzbuzz_input, str))
예제 #46
0
 def test_cheese(self):
     input = [('c', 1), ('h', 1), (1, 1), ('e', 2), ('s', 1), (5, 0),
              (12, 1), (55, 1), (1, 2), ('e', 1), (1, 1)]
     self.assertEqual("cheese", solution.extract_type(input, str))