How to use the pmxbot.stack.stack function in pmxbot

To help you get started, we’ve selected a few pmxbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yougov / pmxbot / tests / unit / test_stack.py View on Github external
"""Set Store.stack to a dummy with ROYGBIV color names as items."""
        Stack.store = DummyStorage(
            {
                "fumanchu": [
                    "red",
                    "orange",
                    "yellow",
                    "green",
                    "blue",
                    "indigo",
                    "violet",
                ]
            }
        )
        self.assertEqual(
            stack("fumanchu", "show"),
            "1: red | 2: orange | 3: yellow | 4: green | "
            "5: blue | 6: indigo | 7: violet",
github yougov / pmxbot / tests / unit / test_stack.py View on Github external
def test_stack_show_integer_index(self):
        self.make_colors()

        self.assertEqual(stack("fumanchu", 'show [2]'), "2: orange")
        self.assertEqual(stack("fumanchu", 'show [-1]'), "7: violet")
        self.assertEqual(stack("fumanchu", 'show [0]'), "(empty)")
        self.assertEqual(stack("fumanchu", 'show [-1200]'), "(empty)")
github yougov / pmxbot / tests / unit / test_stack.py View on Github external
def test_stack_help(self):
        Stack.store = DummyStorage()
        self.assertEqual(stack("fumanchu", "help"), helpdoc["help"])
        self.assertEqual(stack("fumanchu", "help add"), helpdoc["add"])
        self.assertEqual(stack("fumanchu", "help pop"), helpdoc["pop"])
        self.assertEqual(stack("fumanchu", "help show"), helpdoc["show"])
        self.assertEqual(stack("fumanchu", "help shuffle"), helpdoc["shuffle"])
        self.assertEqual(stack("fumanchu", "help index"), helpdoc["index"])
        self.assertEqual(stack("fumanchu", "help stack"), helpdoc["stack"])
        self.assertEqual(stack("fumanchu", "help topics"), helpdoc["topics"])
        self.assertEqual(stack("fumanchu", "help list"), helpdoc["topics"])

        self.assertEqual(stack("fumanchu", "not a command"), helpdoc["stack"])
github yougov / pmxbot / tests / unit / test_stack.py View on Github external
def test_stack_help(self):
        Stack.store = DummyStorage()
        self.assertEqual(stack("fumanchu", "help"), helpdoc["help"])
        self.assertEqual(stack("fumanchu", "help add"), helpdoc["add"])
        self.assertEqual(stack("fumanchu", "help pop"), helpdoc["pop"])
        self.assertEqual(stack("fumanchu", "help show"), helpdoc["show"])
        self.assertEqual(stack("fumanchu", "help shuffle"), helpdoc["shuffle"])
        self.assertEqual(stack("fumanchu", "help index"), helpdoc["index"])
        self.assertEqual(stack("fumanchu", "help stack"), helpdoc["stack"])
        self.assertEqual(stack("fumanchu", "help topics"), helpdoc["topics"])
        self.assertEqual(stack("fumanchu", "help list"), helpdoc["topics"])

        self.assertEqual(stack("fumanchu", "not a command"), helpdoc["stack"])
github yougov / pmxbot / tests / unit / test_stack.py View on Github external
def test_stack_pop_integer_index(self):
        self.make_colors()

        self.assertEqual(stack("fumanchu", 'pop [2]'), "-: orange")
        self.assertEqual(
            stack("fumanchu", "show"),
            "1: red | 2: yellow | 3: green | 4: blue | 5: indigo | 6: violet",
        )

        self.assertEqual(stack("fumanchu", 'pop [-1]'), "-: violet")
        self.assertEqual(
            stack("fumanchu", "show"),
            "1: red | 2: yellow | 3: green | 4: blue | 5: indigo",
        )

        self.assertEqual(stack("fumanchu", 'pop [0]'), "(none popped)")
        self.assertEqual(
            stack("fumanchu", "show"),
            "1: red | 2: yellow | 3: green | 4: blue | 5: indigo",
        )
github yougov / pmxbot / tests / unit / test_stack.py View on Github external
def test_stack_topic_as_nick(self):
        self.make_colors()
        self.assertEqual(stack("sarah", ""), "(empty)")
        self.assertEqual(stack("sarah", "add write tests"), None)
        self.assertEqual(stack("sarah", "show"), "1: write tests")
        # Working on sarah's topic shouldn't alter fumanchu's
        self.assertEqual(
            stack("fumanchu", "show"),
            "1: red | 2: orange | 3: yellow | 4: green | "
            "5: blue | 6: indigo | 7: violet",
github yougov / pmxbot / tests / unit / test_stack.py View on Github external
def test_stack_explicit_topics(self):
        self.make_colors()
        self.assertEqual(stack("fumanchu", "show project1[]"), "(empty)")
        self.assertEqual(stack("fumanchu", "add project1[] write tests"), None)
        self.assertEqual(stack("fumanchu", "show project1[]"), "1: write tests")
        # Working on project1's topic shouldn't alter fumanchu's
        self.assertEqual(
            stack("fumanchu", "show"),
            "1: red | 2: orange | 3: yellow | 4: green | "
            "5: blue | 6: indigo | 7: violet",
github yougov / pmxbot / tests / unit / test_stack.py View on Github external
def test_stack_show_integer_index(self):
        self.make_colors()

        self.assertEqual(stack("fumanchu", 'show [2]'), "2: orange")
        self.assertEqual(stack("fumanchu", 'show [-1]'), "7: violet")
        self.assertEqual(stack("fumanchu", 'show [0]'), "(empty)")
        self.assertEqual(stack("fumanchu", 'show [-1200]'), "(empty)")
github yougov / pmxbot / tests / unit / test_stack.py View on Github external
def test_stack_topics_command(self):
        self.make_colors()
        stack("sarah", "add bar")
        stack("fumanchu", "add project1[] foo")
        self.assertEqual(
            stack("fumanchu", "topics"), "1: fumanchu | 2: project1 | 3: sarah"
        )
        self.assertEqual(stack("fumanchu", 'topics [2]'), "2: project1")
        self.assertEqual(stack("fumanchu", 'topics [-1]'), "3: sarah")
        self.assertEqual(stack("fumanchu", 'topics [0]'), "(empty)")
        self.assertEqual(stack("fumanchu", 'topics [-1200]'), "(empty)")
github yougov / pmxbot / tests / unit / test_stack.py View on Github external
def test_stack_pop_multiple_indices(self):
        self.make_colors()

        self.assertEqual(
            stack("fumanchu", "pop [3, -2, 2]"), "-: orange | -: yellow | -: indigo"
        )
        self.assertEqual(
            stack("fumanchu", "show"), "1: red | 2: green | 3: blue | 4: violet"
        )