• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / ZopeUndo / 16399719109

28 Apr 2025 06:42AM UTC coverage: 100.0%. Remained the same
16399719109

push

github

web-flow
Update Python version support. (#9)

* Drop support for Python 3.7, 3.8.

* Add support for Python 3.12, 3.13.

18 of 18 branches covered (100.0%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

44 of 44 relevant lines covered (100.0%)

1.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/ZopeUndo/Prefix.py
1
##############################################################################
2
#
3
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
4
# All Rights Reserved.
5
#
6
# This software is subject to the provisions of the Zope Public License,
7
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
8
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11
# FOR A PARTICULAR PURPOSE
12
#
13
##############################################################################
14

15

16
class Prefix:
1✔
17
    """A Prefix() is equal to any path it is a prefix of.
18

19
    This class can be compared to a string.
20
    The comparison will return True if all path elements of the
21
    Prefix are found at the beginning of the string being compared.
22

23
    Two Prefixes can not be compared.
24
    """
25

26
    __no_side_effects__ = 1
1✔
27

28
    def __init__(self, path):
1✔
29
        path_list = path.split('/')
1✔
30
        self.length = len(path_list)
1✔
31
        self.path = path_list
1✔
32

33
    def __eq__(self, o):
1✔
34
        other_path = o.split('/')
1✔
35
        if other_path and ' ' in other_path[-1]:
1✔
36
            # don't include logged username in comparison
37
            pos = other_path[-1].rfind(' ')
1✔
38
            other_path[-1] = other_path[-1][:pos]
1✔
39
        return other_path[:self.length] == self.path
1✔
40

41
    def __ne__(self, o):
1✔
42
        return not self.__eq__(o)
1✔
43

44
    def __repr__(self):
1✔
45
        # makes failing tests easier to read
46
        return "Prefix('%s')" % '/'.join(self.path)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc