예제 #1
0
    def given_markdown_lines(_):
        return unindent("""
        Shamonay

        # 1
        (ignore this table: ohai)

        |aa|bb|cc|
        |---|---|---
        |one|two|

        ## 2
        |dd|ee|ff|
        |---|---|---
        |x1|x2|x3

        ## 3

        (ignore this table)
        |hh|ii|
        |---|---|
        |y1|y2

        yup
        """)
예제 #2
0
    def given_markdown_lines(_):
        return unindent("""
        hello

        |aa|bb|cc|
        |---|---|---
        """)
예제 #3
0
 def given_big_string(self):
     return ''.join(
         unindent("""
             aa
             bb
             cc
             dd
             """))
예제 #4
0
    def given_markdown_lines(_):
        return unindent("""
        # Zib Zub super table

        |aa|bb|cc|
        |---|---|---
        |x1|x2|x3
        |x4|x5|x6|

        """)
예제 #5
0
    def test_200_stdout_is_deleted_lines(self):

        _actual = self.common_entity_screen.stdout_lines

        _expected = tuple(
            unindent("""
        [item.B7G.attributes]
        thing_1 = "hi G"
        thing_2 = "hey G"
        """))

        self.assertSequenceEqual(_actual, _expected)
    def test_100_EVERYTHING(self):  # NOTE subject not memoized
        rec, = self.recorded_file_rewrites

        _expected = tuple(unindent("""
        [item.24.attributes]
        xw = "nü"
        xx = "xx of 24 updated"
        [item.68.attributes]
        """))

        _actual = rec.lines[0:4]

        self.assertSequenceEqual(_actual, _expected)
예제 #7
0
    def test_200_stdout_is_updated_lines_CAPTURE_WS_ISSUE(self):

        _actual = self.common_entity_screen.stdout_lines

        _expected = tuple(
            unindent("""
        [item.B7F.attributes]
        thing_2 = "hey F updated"

        thing_3 = "T3"
        thing_4 = "T4"
        """))

        self.assertSequenceEqual(_actual, _expected)
예제 #8
0
    def new_f(self):

        # resolve expect lines

        x = self.expect_these_lines()
        _expect_lines = () if x is None else tuple(unindent(x))  # #here1

        # resolve existing lines

        _existing_lines = unindent(self.given_big_string())

        # resolve listener
        from modality_agnostic import throwing_listener as listener

        # work

        _out_lines_itr = orig_f(self, {
            'existing_file_lines': _existing_lines,
            'listener': listener,
        })

        _actual = tuple(_out_lines_itr)

        self.assertEqual(_actual, _expect_lines)
    def test_200_entities_file_rewritten_OK(self):
        rec, = self.recorded_file_rewrites
        _actual = _last_1_of_path(rec.path)

        self.assertEqual(_actual, 'entities.toml')

        _hi = rec.lines[2:6]

        _expect = tuple(unindent("""
        [item.43.attributes]
        abc = "123"
        de_fg = "true"
        [item.68.attributes]
        """))

        self.assertSequenceEqual(_hi, _expect)
예제 #10
0
    def test_200_lines_wow(self):
        lines = self.end_state.lines
        _actual_big_string = ''.join(lines)  # correct an issue todo
        _actual_lines = tuple(_lines_via_big_string_as_is(_actual_big_string))

        _expect_big_s = """
        {
          "identifier_string": "B9H",
          "core_attributes": {
            "thing_A": "hi i'm B9H",
            "thing_B": "hey i'm B9H"
          }
        }
        """

        _expect_lines = tuple(unindent(_expect_big_s))
        self.assertSequenceEqual(_actual_lines, _expect_lines)
    def test_100_EVERYTHING(self):  # NOTE subject not memoized

        rec, = self.recorded_file_rewrites

        """.#open [#867.H] here (also) is doing the bad thing where it
        greedily consumes all comments and whitespace after an entity and
        thinks of that is part of the entity. the desired behavior would be
        to walk-back the cut-off point to just before the first blank line
        after the entity, but this will take busy work..
        """

        _expect = tuple(unindent("""
        [item.24.attributes]
        xx = "xx of 24"
        """))

        self.assertSequenceEqual(rec.lines, _expect)
    def given_lines(self):

        # DISCUSSION: below might be too much, but it's exactly what we had
        # in a file when we made it a file, and it's representative & useful
        # this way

        return unindent('''
            [item.2K9.attributes]
            ting = """
            [item.ABC.attributes]
            """
            tang = 'tong'

            [item.2KA.attributes]
            thing = "x"

            # #born.
            ''')
예제 #13
0
    def given_markdown_lines(_):
        return unindent("""
        Shamonay

        # 1
        (zig zug)

        |aa|bb|cc|
        |---|---|---
        |eg|[#867.5.1]
        |x1|x2|x3
        |x4|x5|x6|

        ## 2
        |dd|ee|ff|
        |---|---|---
        |x|x|x
        """)
예제 #14
0
    def test_200_stdout_lines_are_toml_lines_of_created_fellow(self):
        # (the leading blank line belo keeps the first line out of test output)
        """

        currently what is written to stdout on successful create is simply
        the same lines of the mutable document entity that were inserted into
        this entities file.

        contrast this with what RETRIEVE (Case4292) does, which is to express
        to the user the retrieved entity as *json* (not toml).

        to have these two operations behave differently in this regard is
        perhaps a violation of "the principle of least astonishment"; but
        we uphold this inconsistency (for now) on these grounds:

        - the founding purpose of the CLI is towards a crude, quick-and-dirty
          debugging & development tool; not to be pretty & perfect (yet).

        - there is arguably one UI/UX benefit to the current way: when storing
          as opposed to retrieving, the user wants visual confirmation that
          nothing strange happened in encoding their "deep" data into a
          surface representation for this particular datastore.

        :#HERE3
        """

        _actual = self.common_entity_screen.stdout_lines

        _expected = tuple(
            unindent("""
        [item.2H3.attributes]
        aa = "AA"
        bb = "BB"
        """))

        self.assertSequenceEqual(_actual, _expected)
 def expect_lines_before_edit(self):
     _big_s = self.expect_these_lines_before_edit()
     _expected_lines_gen = unindent(_big_s)
     self._expect_doc_ent_lines(self.subject, _expected_lines_gen)
 def expect_edit(self):
     _expect = unindent(self.expect_these_body_lines_AFTER_edit())
     _mde = self.given_run(None)  # ..
     self._expect_doc_ent_body_lines(_mde, _expect)
 def given_lines(self):
     return unindent("""
     # the only line
     """)
 def given_lines(self):
     return unindent("""
     # line 1
     bb = "line 2"
     # line 3
     """)
    def given_lines(self):
        return unindent("""
        foo_bar = BAZ
        # comment line

        """)
 def given_lines(self):
     return unindent("""
     aa = "bb"
     # comment third
     """)
 def given_lines(self):
     return unindent("""
     # comment B
     # comment C
     """)
 def given_lines(self):
     return unindent("""
     # comment alpha
     """)
 def given_lines(self):
     return unindent("""
     biff_BON_zo_10 = 'bangeurs'
     foo_bar = BAZ
     BIFFB_on_ZO10 = 123
     """)
예제 #24
0
 def new_lines_via_entity(_mde_, _listener_):
     return tuple(unindent(new_s))
예제 #25
0
 def _expect_everything_for_create(self, kwargs):
     id_s, new_s = self.given_identifer_and_lines_for_new_entity()
     _incoming_lines = unindent(new_s)
     return _subj_mod().new_lines_via_create_and_existing_lines(
         new_entity_lines=_incoming_lines, identifier_string=id_s, **kwargs)
 def expect_body_lines_before_edit(self):
     _big_s = self.expect_these_body_lines_before_edit()
     _expected_lines_gen = unindent(_big_s)
     _actual_lines_gen = _body_line_gen(self.subject)
     self._expect_lines(_actual_lines_gen, _expected_lines_gen)