Skip to content
This repository has been archived by the owner on Aug 13, 2022. It is now read-only.

Commit

Permalink
Fix divider 286 from being buggy with the GitHub UI
Browse files Browse the repository at this point in the history
Signed-off-by: Reece Dunham <me@rdil.rocks>
  • Loading branch information
RDIL committed Oct 2, 2020
1 parent d69e193 commit cc7454e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This project is intended to be...
- Documented. Keep it well documented, so all can learn from it.
- Reusable. Keep it clean and modular, with as little responsibility per programming unit (function, method, class, module, project) as possible, so one can reuse it.
- Testable. Keep it easy to debug and test, so one can be confident that it works properly. Please keep the [Cirrus CI Build](https://cirrus-ci.com/github/area4lib/area4) at passing if possible.
- Python 3 compatible. area4 aims to support Python 3 versions, and does not support versions below Python3.
- Python 3 compatible. area4 aims to support Python 3 versions, and does not support versions below Python 3.

## Timing

Expand Down
1 change: 1 addition & 0 deletions area4/dividers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ $$$$$$$$$$$$
酶酶酶酶酶酶酶酶酶酶酶酶
脴脴脴脴脴脴脴脴脴脴脴脴
馃敪馃敪馃敪馃敪馃敪馃敪馃敪馃敪馃敪馃敪馃敪馃敪
# Injected at runtime
馃毃馃毃馃毃馃毃馃毃馃毃馃毃馃毃馃毃馃毃馃毃馃毃
馃懏馃懏馃懏馃懏馃懏馃懏馃懏馃懏馃懏馃懏馃懏馃懏
鉁旓笍鉁旓笍鉁旓笍鉁旓笍鉁旓笍鉁旓笍鉁旓笍鉁旓笍鉁旓笍鉁旓笍鉁旓笍鉁旓笍
Expand Down
7 changes: 4 additions & 3 deletions area4/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@

def non_single_character_dividers():
"""
Get a list of all the "blacklisted" dividers.
Get a list of all the dividers that are multiple unique characters.
These dividers are not made of a single character.
Some examples of this include:
* Divider 18 - :code:`( 汀掳 蜏蕱 汀掳)`
Expand All @@ -25,7 +24,7 @@ def non_single_character_dividers():
:return: A list of divider IDs.
:rtype: List[int]
"""
return [18, 19, 22, 33, 34, 35, 222, 223, 224, 226, 233, 234, 242, 244]
return [18, 19, 22, 33, 34, 35, 222, 223, 224, 226, 233, 234, 242, 244, 286]


@lru_cache(maxsize=None)
Expand Down Expand Up @@ -53,6 +52,8 @@ def get_raw_file():
# a conflict marker
lines[32] = "<><><><><><>"
lines[35] = str(random.randint(0, 999999999999))
# same as 32
lines[286] = ">>>>>>>>>>>>"
return lines


Expand Down
21 changes: 13 additions & 8 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ def test_dividers(self):
for i in range(len(self.raw_dividers)):
# Try to match the raw divider with the result
# of the function:
if i != 35 and i != 0 and i != 32:
if i not in [0, 32, 35, 286]:
self.assertEqual(
self.raw_dividers[i].replace("\n", ""),
area4.divider(i),
f"Divider number {i} was not the same in the file and in the code. Please ask a maintainer for help.",
)
elif (i == 35 or i == 32) and i != 0:
elif i in [32, 35, 286] and i != 0:
self.assertNotEqual(self.raw_dividers[i], area4.divider(i))
finally:
pass
Expand Down Expand Up @@ -107,15 +107,20 @@ def test_for_divider_duplicates(self):
for g, h in enumerate(self.raw_dividers):
if x == g:
# during enumeration, the divider will find itself
self.assertEqual(self.raw_dividers[x], self.raw_dividers[g])
else:
# but all the other times it will be another divider
# which can NOT be equal!
self.assertNotEqual(
self.assertEqual(
self.raw_dividers[x],
self.raw_dividers[g],
f"Dividers {x} and {g} are the same! Duplicates are not allowed.",
f"Divider {x} couldn't find itself! This really should not happen.",
)
else:
if "Injected" not in self.raw_dividers[x]:
# but all the other times it will be another divider
# which can NOT be equal!
self.assertNotEqual(
self.raw_dividers[x],
self.raw_dividers[g],
f"Dividers {x} and {g} are the same! Duplicates are not allowed.",
)

def test_info(self):
"""Test info."""
Expand Down

0 comments on commit cc7454e

Please sign in to comment.