import zlib l='L1' exec(str(zlib.decompress(bytes("xÚMP=oÂ0ý+¯YXC[u@B,h§v©ÄâØpqìÈw.Eÿ½DåÅzw÷¾~eL×8·ª±Í¾\"ªº_UØ1HÛÒy!³¤äXÕ¬>wM\nj¶Ú¤®ÏÄ`ò Ê9wI-äàyè/>;lr´ØÅÏ+¬;Ãx~yxÜyBðj¼R@|¥V 8rRCmv´[ù2IL¢5½9ß»ë`'zbä~·Àïú@àÊÔÂß e$ßUããT²½&»¼§Lc¦,ø1Ù(ð¼KPìÔ\nERvÐÜõ&¨Ù£t£~C©òNÿZ5QÇklÌäý½uíq÷k¼Ìö@ö/Õ¸ª",encoding=l)),l))
text=lambda d="description ",k=" Kata or Kumite ",r=" return",s=" symbols ": f"Compress large text - {d}of this{k}in small code.\nThis{k}{d}has 462{s}in 3 line, without title. You should wrote function,{r} this text, but you should use less{s}in you'r code that this text. Simple solution - just{r} \"\"\"source text\"\"\". More smart variant is: do mark often word as special{s}and replace his before{r}.\nHow small code can be? Can you wrote more compressing? Let's check it!"- import zlib
- l='L1'
- exec(str(zlib.decompress(bytes("xÚMP=oÂ0ý+¯YXC[u@B,h§v©ÄâØpqìÈw.Eÿ½DåÅzw÷¾~eL×8·ª±Í¾\"ªº_UØ1HÛÒy!³¤äXÕ¬>wM\nj¶Ú¤®ÏÄ`ò Ê9wI-äàyè/>;lr´ØÅÏ+¬;Ãx~yxÜyBðj¼R@|¥V 8rRCmv´[ù2IL¢5½9ß»ë`'zbä~·Àïú@àÊÔÂß e$ßUããT²½&»¼§Lc¦,ø1Ù(ð¼KPìÔ\nERvÐÜõ&¨Ù£t£~C©òNÿZ5QÇklÌäý½uíq÷k¼Ìö@ö/Õ¸ª",encoding=l)),l))
import codewars_test as test import inspect import solution # from solution # test.assert_equals(actual, expected, [optional] message) @test.describe("Test of compression text") def test_group(): # todo please, correct this number after make cnage method_size=504 module_size=504 text_size=464 text_expected="""Compress large text - description of this Kata or Kumite in small code. This Kata or Kumite description has 462 symbols in 3 line, without title. You should wrote function, return this text, but you should use less symbols in you'r code that this text. Simple solution - just return \"\"\"source text\"\"\". More smart variant is: do mark often word as special symbols and replace his before return. How small code can be? Can you wrote more compressing? Let's check it!""" @test.it("Text check") def test_case_text(): expected = text_expected test.assert_equals(solution.text(), expected) test.assert_equals(solution.text(), expected) @test.it("Test of test") def test_text(): expected = text_expected test.assert_equals(len(text_expected), text_size) src=inspect.getsource(solution) src_len=len(src) test.assert_equals((src_len>= 5),True, "Test not see solution source") @test.it("Source module check") def test_case_source_function(): src=inspect.getsource(solution) src_len=len(src) print("Size of all source code length is "+str(src_len)) test.assert_equals((src_len<= module_size),True, "Source code of all module too large: "+str(src_len)+". Do not hidde data out of the function.") if src_len< module_size: print(f"New code less up to {module_size-src_len} symbol!") if (src_len<text_size): print(f"Congradulation! The code less that text at {text_size-src_len} symbol.")
- import codewars_test as test
- import inspect
- import solution # from solution
- # test.assert_equals(actual, expected, [optional] message)
- @test.describe("Test of compression text")
- def test_group():
- # todo please, correct this number after make cnage
- method_size=504
- module_size=504
- text_size=464
- text_expected="""Compress large text - description of this Kata or Kumite in small code.
- This Kata or Kumite description has 462 symbols in 3 line, without title. You should wrote function, return this text, but you should use less symbols in you'r code that this text. Simple solution - just return \"\"\"source text\"\"\". More smart variant is: do mark often word as special symbols and replace his before return.
- How small code can be? Can you wrote more compressing? Let's check it!"""
- @test.it("Text check")
- def test_case_text():
- expected = text_expected
- test.assert_equals(solution.text(), expected)
- test.assert_equals(solution.text(), expected)
- @test.it("Test of test")
- def test_text():
- expected = text_expected
- test.assert_equals(len(text_expected), text_size)
- src=inspect.getsource(solution)
- src_len=len(src)
- test.assert_equals((src_len>= 5),True, "Test not see solution source")
@test.it("Source function check")def test_case_source_function():src=inspect.getsource(solution.text)src_len=len(src)#test.assert_equals(src, "see method")print("Size of source code 'def test()' is "+str(src_len))test.assert_equals((src_len<= method_size),True, "Function 'def test()' too large: "+str(src_len))test.assert_equals((src_len>= 4),True, "How wrote methd more small that he's call?") # test should see methodif src_len< method_size: print(f"New function less up to {method_size-src_len} symbol!")- @test.it("Source module check")
- def test_case_source_function():
- src=inspect.getsource(solution)
- src_len=len(src)
- print("Size of all source code length is "+str(src_len))
- test.assert_equals((src_len<= module_size),True, "Source code of all module too large: "+str(src_len)+". Do not hidde data out of the function.")
- if src_len< module_size: print(f"New code less up to {module_size-src_len} symbol!")
- if (src_len<text_size): print(f"Congradulation! The code less that text at {text_size-src_len} symbol.")